54 lines
1.1 KiB
Plaintext
54 lines
1.1 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
email String @unique
|
|
password String
|
|
collections Collection[]
|
|
collectionsJoined UserAndCollection[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model Collection {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
owner User @relation(fields: [ownerId], references: [id])
|
|
ownerId Int
|
|
members UserAndCollection[]
|
|
links Link[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model UserAndCollection {
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int
|
|
|
|
collection Collection @relation(fields: [collectionId], references: [id])
|
|
collectionId Int
|
|
|
|
canCreate Boolean
|
|
canRead Boolean
|
|
canUpdate Boolean
|
|
canDelete Boolean
|
|
|
|
@@id([userId, collectionId])
|
|
}
|
|
|
|
model Link {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
url String
|
|
collection Collection @relation(fields: [collectionId], references: [id])
|
|
collectionId Int
|
|
} |