```model User { id String @default(cuid()) @@...
# orm-help
i
Copy code
model User {
  id String @default(cuid())

  @@id([id])
}

model Group {
  id String @default(cuid())

  @@id([id])
}

model Member {
  group   Group  @relation(fields: [groupId], references: [id])
  groupId String
  user    User   @relation(fields: [id], references: [id])
  id      String

  @@id([groupId, id])
}
When creating user only it works fine, no problem with the default generation value of cuid() But When creating group only it doesn't work it says Null constraint error for id both from API and PRISMA studio Why does my default cuid doesnt work? Current workaround use cuid npm package
r
@Ian 👋 First of all, your schema is incorrect. It should be like this:
Copy code
model User {
  id     String   @id @default(cuid())
  groups Member[]
}

model Group {
  id    String   @id @default(cuid())
  users Member[]
}

model Member {
  group   Group  @relation(fields: [groupId], references: [id])
  groupId String
  user    User   @relation(fields: [id], references: [id])
  id      String

  @@id([groupId, id])
}
Are you using VSCode? If so, then I would suggest using this extension that will create the relations correctly. As for creating a Group, it works fine for me on the latest version of Prisma i.e. 2.26.0. Could you update to the latest and check?
❤️ 1
i
Thanks @Ryan I just overlooked the other relationships like you said.. Thanks!!!
🙌 1