Scai
Scai
Explore posts from servers
DTDrizzle Team
Created by Scai on 10/28/2023 in #help
Query only one item from Many-To-Many
I would like only to take one stat not all the arrays. Is there a method to replace limit with something which returns only one item.
const res = await ctx.db.query.servers.findMany({
with: {
game: true,
stat: {
limit: 1,
orderBy: (table, { desc }) => [desc(table.statId)],
with: {
stat: true,
},
},
},
});
const res = await ctx.db.query.servers.findMany({
with: {
game: true,
stat: {
limit: 1,
orderBy: (table, { desc }) => [desc(table.statId)],
with: {
stat: true,
},
},
},
});
21 replies
DTDrizzle Team
Created by Scai on 10/28/2023 in #help
Error on db:push
Incorrect table definition; there can be only one auto column and it must be defined as a key
3 replies