siim
siim
Explore posts from servers
DTDrizzle Team
Created by siim on 10/21/2024 in #help
Marking a Query relation as `required`?
I currently have a query like:
const friendTransactions = await db.query.transactions.findMany({
with: {
splits: {
where: (splits, { eq }) => eq(splits.friendId, foundFriend.id),
},
},
});
const friendTransactions = await db.query.transactions.findMany({
with: {
splits: {
where: (splits, { eq }) => eq(splits.friendId, foundFriend.id),
},
},
});
and I want to include splits where the friendId matches a specific value. This works, except I can't figure out the correct way to mark that relation as required (as in, I don't want to have the transaction row returned unless a split row exists that meets the filter condition. This has been a super easy feature in every other ORM I've used, but I can't find anything about it in the Drizzle docs. Anyone know how to accomplish this (preferably without reverting everything to a select() instead)
1 replies
DTDrizzle Team
Created by siim on 8/22/2023 in #help
`migrate()` prints to stdout
When I run the migrate() function it always prints content to stdout, and I can't find a way to disable it. I'm using migrate in tests, and it's super annoying because it's polluting the console and making the test output difficult to read. Does anyone know a workaround for this?
4 replies