Drizzle TeamDT
Drizzle Team3y ago
7 replies
benjick

How to handle relations during insert?

Is this correct? Feels like I should be able to do it in one call, but values doesn't accept anything else
const group = await db
  .insert(groups)
  .values({ name: inputs.name })
  .returning();
await db.insert(usersToGroups).values({
  groupId: group[0]!.id,
  userId: session.user.id,
});
Was this page helpful?