T.T
T.T
Explore posts from servers
DTDrizzle Team
Created by jz on 11/11/2023 in #help
Multiple .where() calls with $dynamic not working
I thought it was a little strange to have the motivating example given and then the example being withPagination and not something that builds on the double where function call. It makes more sense now 😁
20 replies
DTDrizzle Team
Created by jz on 11/11/2023 in #help
Multiple .where() calls with $dynamic not working
Yeah I've been doing something similar for a while now. I think I was confused by the release notes and the documentation for the dynamic function. It might just be me or it may be something people also assume is different due to the motivating example in both of these having a chained where and people expecting it to work when you use a dynamic query (as it often does in other ORMs and query builders or with something similar like andWhere being a function) I think in reality it just lets you overwrite (or add if they don't exist) parts to the query after the first definition of it. Thanks for your time though, I'd have been confused about this next week otherwise 😄
20 replies
DTDrizzle Team
Created by T.T on 11/10/2023 in #help
Table foreign key action fields
For anyone reading this in the future: You can provide onUpdate and onDelete actions as functions which you apply to the foreignKey function within your table config. They aren't part of the arguments of the foreignKey functions like they previously were for the references use case. Such as: Fk: foreignKey({...}).onUpdate().onDelete()
2 replies
DTDrizzle Team
Created by jz on 11/11/2023 in #help
Multiple .where() calls with $dynamic not working
Am I misunderstanding what the dynamic feature is able to do? From what I understand from the notes it should allow for you to call where multiple times and have it work like the original question here has code for in that code sandbox link
20 replies
DTDrizzle Team
Created by jz on 11/11/2023 in #help
Multiple .where() calls with $dynamic not working
But the notes for the dynamic feature state: "which removes the restriction of invoking methods only once." This is after showing the example where there is an error when the code has a where followed by another where
20 replies
DTDrizzle Team
Created by jz on 11/11/2023 in #help
Multiple .where() calls with $dynamic not working
Isn't the motivating example in the release notes basically suggesting you can call where multiple times when using dynamic queries though? Also the quote: "However, it becomes a problem when you want to build a query dynamically, i.e. if you have a shared function that takes a query builder and enhances it. To solve this problem, Drizzle provides a special 'dynamic' mode for query builders, which removes the restriction of invoking methods only once" I expected it to allow for what is in the code sandbox (without having tried it yet)
20 replies