Created
August 11, 2020 23:13
-
-
Save nmchenry01/12427c125f95ea088fc0be36e16d0b2e to your computer and use it in GitHub Desktop.
An example Prisma schema for "Prisma vs. TypeORM"
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
generator client { | |
provider = "prisma-client-js" | |
previewFeatures = ["transactionApi"] | |
} | |
datasource db { | |
provider = "postgresql" | |
url = env("DATABASE_URL") | |
} | |
model Company { | |
id Int @default(autoincrement()) @id | |
name String @unique | |
createdAt DateTime @default(now()) | |
products Product[] | |
} | |
model Customer { | |
id Int @default(autoincrement()) @id | |
username String @unique | |
email String @unique | |
createdAt DateTime @default(now()) | |
products Product[] @relation(references: [id]) | |
} | |
model Product { | |
id Int @default(autoincrement()) @id | |
name String @unique | |
description String? | |
createdAt DateTime @default(now()) | |
companyId Int | |
company Company @relation(fields: [companyId], references: [id]) | |
customers Customer[] @relation(references: [id]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment