ippo
ippo
Explore posts from servers
DTDrizzle Team
Created by ippo on 5/8/2024 in #help
automatic flatten nested query result
I have schema that looks like this: users <--manyTomany--> roles <--manyTomany--> permissions I implemented all the required bridge tables and I am able to query a user, its roles and its permissions with the with: {} query api the result that I is very nested and I would like to know if there is a way to direcly get all permissions of a user even if it is hidden in a many to many relationship? I could do that with some map and Set logic, but does maybe drizzle offers you some utils for that?
3 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
In Drizzle you can make a one to many query like this:
const result = await db.query.users.findMany({
with: {
posts: true
},
});
const result = await db.query.users.findMany({
with: {
posts: true
},
});
with that query I get the user and its posts there are some questions that I have 1. Can I use pure SQL in that query that uses the ORM-like syntax? 2. how can I write a query with the SQL-like syntax that allows me to select for each table separate fields
25 replies
DTDrizzle Team
Created by ippo on 9/15/2023 in #help
TRIGGERS in Drizzle
Is there a way to define/implement TRIGGERs in Drizzle? An example would be great!
13 replies