el.xwx.moe/prisma/schema.prisma

74 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-01-31 05:36:56 -06:00
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
2023-01-31 05:36:56 -06:00
name String
email String @unique
2023-01-31 05:36:56 -06:00
password String
collections Collection[]
2023-03-28 02:31:50 -05:00
tags Tag[]
collectionsJoined UsersAndCollections[]
isPrivate Boolean @default(false)
2023-05-18 13:02:17 -05:00
whitelistedUsers String[] @default([])
createdAt DateTime @default(now())
2023-01-31 05:36:56 -06:00
}
model Collection {
id Int @id @default(autoincrement())
2023-01-31 05:36:56 -06:00
name String
2023-04-24 16:30:40 -05:00
description String @default("")
2023-06-05 04:54:43 -05:00
color String @default("#0ea5e9")
2023-05-28 18:14:44 -05:00
isPublic Boolean @default(false)
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
members UsersAndCollections[]
links Link[]
createdAt DateTime @default(now())
2023-03-28 02:31:50 -05:00
@@unique([name, ownerId])
2023-01-31 05:36:56 -06:00
}
model UsersAndCollections {
2023-01-31 05:36:56 -06:00
user User @relation(fields: [userId], references: [id])
userId Int
2023-01-31 05:36:56 -06:00
collection Collection @relation(fields: [collectionId], references: [id])
collectionId Int
2023-01-31 05:36:56 -06:00
canCreate Boolean
canUpdate Boolean
canDelete Boolean
2023-01-31 05:36:56 -06:00
@@id([userId, collectionId])
}
model Link {
id Int @id @default(autoincrement())
name String
url String
2023-03-06 14:08:11 -06:00
title String
collection Collection @relation(fields: [collectionId], references: [id])
collectionId Int
tags Tag[]
2023-03-06 14:08:11 -06:00
screenshotPath String
pdfPath String
createdAt DateTime @default(now())
}
model Tag {
id Int @id @default(autoincrement())
name String
links Link[]
2023-03-28 02:31:50 -05:00
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
2023-03-28 02:31:50 -05:00
@@unique([name, ownerId])
2023-06-02 06:59:52 -05:00
}