148 lines
3.9 KiB
Plaintext
148 lines
3.9 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
|
|
|
|
username String? @unique
|
|
|
|
email String? @unique
|
|
emailVerified DateTime?
|
|
image String?
|
|
|
|
password String
|
|
|
|
collections Collection[]
|
|
tags Tag[]
|
|
pinnedLinks Link[]
|
|
collectionsJoined UsersAndCollections[]
|
|
whitelistedUsers WhitelistedUser[]
|
|
|
|
subscriptions Subscription?
|
|
|
|
archiveAsScreenshot Boolean @default(true)
|
|
archiveAsPDF Boolean @default(true)
|
|
archiveAsWaybackMachine Boolean @default(false)
|
|
|
|
isPrivate Boolean @default(false)
|
|
|
|
blurredFavicons Boolean @default(true)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
}
|
|
|
|
model WhitelistedUser {
|
|
id Int @id @default(autoincrement())
|
|
|
|
username String @default("")
|
|
User User? @relation(fields: [userId], references: [id])
|
|
userId Int?
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
}
|
|
|
|
model VerificationToken {
|
|
identifier String
|
|
token String @unique
|
|
expires DateTime
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
|
|
@@unique([identifier, token])
|
|
}
|
|
|
|
model Collection {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
description String @default("")
|
|
color String @default("#0ea5e9")
|
|
isPublic Boolean @default(false)
|
|
|
|
owner User @relation(fields: [ownerId], references: [id])
|
|
ownerId Int
|
|
members UsersAndCollections[]
|
|
links Link[]
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
|
|
@@unique([name, ownerId])
|
|
}
|
|
|
|
model UsersAndCollections {
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int
|
|
|
|
collection Collection @relation(fields: [collectionId], references: [id])
|
|
collectionId Int
|
|
|
|
canCreate Boolean
|
|
canUpdate Boolean
|
|
canDelete Boolean
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
|
|
@@id([userId, collectionId])
|
|
}
|
|
|
|
model Link {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
url String
|
|
description String @default("")
|
|
|
|
pinnedBy User[]
|
|
|
|
collection Collection @relation(fields: [collectionId], references: [id])
|
|
collectionId Int
|
|
tags Tag[]
|
|
|
|
textContent String?
|
|
|
|
screenshotPath String?
|
|
pdfPath String?
|
|
readabilityPath String?
|
|
|
|
lastPreserved DateTime?
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
}
|
|
|
|
model Tag {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
links Link[]
|
|
owner User @relation(fields: [ownerId], references: [id])
|
|
ownerId Int
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
|
|
@@unique([name, ownerId])
|
|
}
|
|
|
|
model Subscription {
|
|
id Int @id @default(autoincrement())
|
|
active Boolean
|
|
stripeSubscriptionId String @unique
|
|
currentPeriodStart DateTime
|
|
currentPeriodEnd DateTime
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int @unique
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
}
|