Ben Guthrie
03/25/2022, 3:24 AMschema.prisma
and the generated migration sql. It looks like foreign key names are in the format of {tableName}_{field}_fkey
but I’m thinking we’d want the name to be something like {sourceTable}_{sourceField}_{targetTable}_{targetField}_fkey
to handle this case. Any thoughts on this? Should I submit an issue to prisma-engines?Nurul
03/25/2022, 6:54 AMmemberships_member_id_fkey
has to be unique in the following namespace: on model Membership
for primary key, indexes, unique constraints and foreign keys. Please provide a different name using the map
argument.
By providing map argument like this should solve the issue like this:
model Membership {
id String @id
memberId String @map("member_id")
memberType String @map("member_type")
memberUser User? @relation(fields: [memberId], references: [id], map: "member_user")
memberGroup Group? @relation(fields: [memberId], references: [id])
@@map("memberships")
}
Are you using latest version of prisma plugin in VS Code?Ben Guthrie
04/18/2022, 10:49 PMNurul
04/19/2022, 8:24 AM