68 lines
1.4 KiB
Plaintext
68 lines
1.4 KiB
Plaintext
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 UsersAndCollections[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model Collection {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
owner User @relation(fields: [ownerId], references: [id])
|
|
ownerId Int
|
|
members UsersAndCollections[]
|
|
links Link[]
|
|
tags Tag[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model UsersAndCollections {
|
|
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
|
|
title String
|
|
collection Collection @relation(fields: [collectionId], references: [id])
|
|
collectionId Int
|
|
tags Tag[]
|
|
isFavorites Boolean
|
|
screenshotPath String
|
|
pdfPath String
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model Tag {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
links Link[]
|
|
collections Collection @relation(fields: [collectionId], references: [id])
|
|
collectionId Int
|
|
|
|
@@unique([name, collectionId])
|
|
} |