plumbe0
plumbe0
Explore posts from servers
DTDrizzle Team
Created by plumbe0 on 11/24/2023 in #help
insert returning relations
for sure. I was just wondering if my .returning() call was missing some params or if this feature is not implemented
11 replies
DTDrizzle Team
Created by plumbe0 on 11/24/2023 in #help
insert returning relations
In Prisma it is possible, I shall ask the devs if they plan to implement it
11 replies
DTDrizzle Team
Created by plumbe0 on 11/24/2023 in #help
insert returning relations
Uhm, I don't need to insert in multiple tables. I need to upsert a user to their table and then have it returned along with their posts. I'm doing upsert like this:
const user = await db
.insert(users)
.values({ id: userId, ...userData })
.onConflictDoUpdate({ target: users.id, set: userData })
.returning()
const user = await db
.insert(users)
.values({ id: userId, ...userData })
.onConflictDoUpdate({ target: users.id, set: userData })
.returning()
I'd like to have the user's posts returned as well. Is it possible? E.g.
.returning({with: { posts: true } })
.returning({with: { posts: true } })
11 replies