ven
ven
Explore posts from servers
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
hang on. let me figure out this call stuff
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
because the example only give many
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
i missed the one part
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
new to discord
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
i dont know know how to start a call 🙂
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
i can jump on a call. are you free now?
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
finally threw in the towel
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
i tried all kinds of stuff to get db.query work
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
i ended up with a left join
const data = await db
.select()
.from(chatRooms)
.leftJoin(
chatRoomParticipants,
eq(chatRooms.id, chatRoomParticipants.chatRoomId)
)
.leftJoin(
profile,
eq(profile.userUid, chatRoomParticipants.userUid)
)
.where(eq(chatRooms.ownerUid, userId));
const data = await db
.select()
.from(chatRooms)
.leftJoin(
chatRoomParticipants,
eq(chatRooms.id, chatRoomParticipants.chatRoomId)
)
.leftJoin(
profile,
eq(profile.userUid, chatRoomParticipants.userUid)
)
.where(eq(chatRooms.ownerUid, userId));
@mast1999
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
i decided to use joins because i couldnt figure out how to setup the relationships post introspection. i wish the documentation was a bit more clear.
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
so its not like Prisma and infer the relations @mast1999 ? would i do this in a seperate file? because what happens when i have to regenerate the schema file through introspection? I am mainly using drizzle for introspection and not for migrations
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
i am getting this error
error Error: Relation chatRooms not found 2:49:16 PM
at PgDialect.buildRelationalQuery (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/alias-3e926a50.mjs:1032:23)
at file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/session-2062e9e6.mjs:285:40
at Object.startActiveSpan (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/alias-3e926a50.mjs:644:20)
at QueryPromise._prepare (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/session-2062e9e6.mjs:284:23)
at file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/session-2062e9e6.mjs:301:25
at Object.startActiveSpan (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/alias-3e926a50.mjs:644:20)
at QueryPromise.execute (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/session-2062e9e6.mjs:300:23)
at QueryPromise.then (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/alias-3e926a50.mjs:636:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
error Error: Relation chatRooms not found 2:49:16 PM
at PgDialect.buildRelationalQuery (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/alias-3e926a50.mjs:1032:23)
at file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/session-2062e9e6.mjs:285:40
at Object.startActiveSpan (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/alias-3e926a50.mjs:644:20)
at QueryPromise._prepare (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/session-2062e9e6.mjs:284:23)
at file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/session-2062e9e6.mjs:301:25
at Object.startActiveSpan (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/alias-3e926a50.mjs:644:20)
at QueryPromise.execute (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/session-2062e9e6.mjs:300:23)
at QueryPromise.then (file:///C:/Users/Ven/OneDrive/Documents/GitHub/project-juniper/App/node_modules/drizzle-orm/alias-3e926a50.mjs:636:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
29 replies
DTDrizzle Team
Created by ven on 7/18/2023 in #help
How to Chain multiple selects
here is my query
const data: any = await db.query.chatMessages.findMany({
where: eq(chatMessages.userUid, query.user_uid),
with: {
// chatRoomParticipants: true,
chatRooms: true,
},
});
const data: any = await db.query.chatMessages.findMany({
where: eq(chatMessages.userUid, query.user_uid),
with: {
// chatRoomParticipants: true,
chatRooms: true,
},
});
29 replies