Created
December 12, 2019 13:02
-
-
Save scriptcoded/aff820c37339b3d9e7b9ec884cda48b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model Company { | |
id String @default(cuid()) @id | |
createdAt DateTime @default(now()) | |
updatedAt DateTime @updatedAt | |
workspaceId Int @unique | |
name String | |
users User[] | |
} | |
model User { | |
id String @default(cuid()) @id | |
createdAt DateTime @default(now()) | |
updatedAt DateTime @updatedAt | |
workspaceId Int @unique | |
givenName String? | |
familyName String? | |
email String | |
companies Company[] | |
} | |
model CompanyUsers { | |
id String @id | |
company Company | |
user User | |
roles String[] | |
} |
Hi @matthewmueller, what makes the difference from your another workarounds about explicit many-to-many described in prisma/prisma#816 (comment) ?
In above schema, both model has a list of relation model while in the gist they directly have list of each others
@ifndefdeadmau5 It was a mistake and the wrong syntax. See the link below. The syntax here is the correct one :)
yep thanks @scriptcoded. sorry for the confusion!
@scriptcoded Thanks for the correction :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this should work: