2023-01-31 05:36:56 -06:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
2023-08-04 16:41:53 -05:00
|
|
|
provider = "postgresql"
|
2023-08-03 23:33:51 -05:00
|
|
|
url = env("DATABASE_URL")
|
2023-01-31 05:36:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
2023-10-27 15:06:42 -05:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
2023-08-03 23:33:51 -05:00
|
|
|
|
2023-10-27 15:06:42 -05:00
|
|
|
username String? @unique
|
2023-08-03 23:33:51 -05:00
|
|
|
|
2023-10-27 15:06:42 -05:00
|
|
|
email String? @unique
|
|
|
|
emailVerified DateTime?
|
2023-10-27 23:45:14 -05:00
|
|
|
image String?
|
2023-08-03 23:33:51 -05:00
|
|
|
|
2023-10-27 15:06:42 -05:00
|
|
|
password String
|
2023-07-08 05:35:43 -05:00
|
|
|
|
2023-11-06 07:25:57 -06:00
|
|
|
collections Collection[]
|
2023-10-27 15:06:42 -05:00
|
|
|
tags Tag[]
|
|
|
|
pinnedLinks Link[]
|
2023-11-06 07:25:57 -06:00
|
|
|
collectionsJoined UsersAndCollections[]
|
|
|
|
whitelistedUsers WhitelistedUser[]
|
|
|
|
|
|
|
|
subscriptions Subscription?
|
2023-06-13 14:19:37 -05:00
|
|
|
|
2023-10-18 23:00:23 -05:00
|
|
|
archiveAsScreenshot Boolean @default(true)
|
|
|
|
archiveAsPDF Boolean @default(true)
|
|
|
|
archiveAsWaybackMachine Boolean @default(false)
|
|
|
|
|
2023-10-27 15:06:42 -05:00
|
|
|
isPrivate Boolean @default(false)
|
2023-11-06 07:25:57 -06:00
|
|
|
|
2023-11-10 21:32:56 -06:00
|
|
|
blurredFavicons Boolean @default(true)
|
|
|
|
|
2023-10-27 15:06:42 -05:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt @default(now())
|
2023-08-03 23:33:51 -05:00
|
|
|
}
|
2023-07-08 05:35:43 -05:00
|
|
|
|
2023-08-04 12:08:04 -05:00
|
|
|
model WhitelistedUser {
|
2023-10-27 15:06:42 -05:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
|
|
|
|
username String @default("")
|
|
|
|
User User? @relation(fields: [userId], references: [id])
|
|
|
|
userId Int?
|
2023-07-08 05:35:43 -05:00
|
|
|
|
2023-10-27 15:06:42 -05:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt @default(now())
|
2023-07-08 05:35:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
model VerificationToken {
|
2023-10-27 15:06:42 -05:00
|
|
|
identifier String
|
|
|
|
token String @unique
|
|
|
|
expires DateTime
|
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt @default(now())
|
2023-07-08 05:35:43 -05:00
|
|
|
|
|
|
|
@@unique([identifier, token])
|
2023-01-31 05:36:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
model Collection {
|
2023-08-03 23:33:51 -05:00
|
|
|
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[]
|
2023-10-27 15:06:42 -05:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt @default(now())
|
2023-03-28 02:31:50 -05:00
|
|
|
|
|
|
|
@@unique([name, ownerId])
|
2023-01-31 05:36:56 -06:00
|
|
|
}
|
|
|
|
|
2023-02-24 11:32:28 -06:00
|
|
|
model UsersAndCollections {
|
2023-08-10 11:16:44 -05:00
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
userId Int
|
2023-01-31 05:36:56 -06:00
|
|
|
|
2023-08-03 23:33:51 -05:00
|
|
|
collection Collection @relation(fields: [collectionId], references: [id])
|
2023-02-13 18:09:13 -06:00
|
|
|
collectionId Int
|
2023-01-31 05:36:56 -06:00
|
|
|
|
2023-08-10 11:16:44 -05:00
|
|
|
canCreate Boolean
|
|
|
|
canUpdate Boolean
|
|
|
|
canDelete Boolean
|
2023-01-31 05:36:56 -06:00
|
|
|
|
2023-10-27 15:06:42 -05:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
|
|
|
2023-01-31 05:36:56 -06:00
|
|
|
@@id([userId, collectionId])
|
2023-02-13 18:09:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
model Link {
|
2023-10-29 23:30:45 -05:00
|
|
|
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[]
|
|
|
|
|
2023-11-01 05:01:26 -05:00
|
|
|
textContent String?
|
|
|
|
|
2023-10-29 23:30:45 -05:00
|
|
|
screenshotPath String?
|
|
|
|
pdfPath String?
|
|
|
|
readabilityPath String?
|
2023-10-31 14:44:58 -05:00
|
|
|
|
|
|
|
lastPreserved DateTime?
|
2023-10-29 23:30:45 -05:00
|
|
|
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt @default(now())
|
2023-02-24 11:32:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
model Tag {
|
2023-08-03 23:33:51 -05:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
|
|
|
links Link[]
|
|
|
|
owner User @relation(fields: [ownerId], references: [id])
|
2023-03-28 02:31:50 -05:00
|
|
|
ownerId Int
|
2023-02-24 11:32:28 -06:00
|
|
|
|
2023-10-27 15:06:42 -05:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
|
|
|
2023-03-28 02:31:50 -05:00
|
|
|
@@unique([name, ownerId])
|
2023-06-02 06:59:52 -05:00
|
|
|
}
|
2023-11-06 07:25:57 -06:00
|
|
|
|
|
|
|
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())
|
|
|
|
}
|