2023-01-31 05:36:56 -06:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
2023-06-26 17:33:40 -05:00
|
|
|
url = env("DATABASE_URL")
|
2023-01-31 05:36:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
2023-02-13 18:09:13 -06:00
|
|
|
id Int @id @default(autoincrement())
|
2023-01-31 05:36:56 -06:00
|
|
|
name String
|
2023-02-13 18:09:13 -06:00
|
|
|
email String @unique
|
2023-01-31 05:36:56 -06:00
|
|
|
password String
|
2023-02-13 18:09:13 -06:00
|
|
|
collections Collection[]
|
2023-03-28 02:31:50 -05:00
|
|
|
tags Tag[]
|
2023-06-13 14:19:37 -05:00
|
|
|
|
|
|
|
pinnedLinks Link[]
|
|
|
|
|
2023-02-24 11:32:28 -06:00
|
|
|
collectionsJoined UsersAndCollections[]
|
2023-05-22 23:08:16 -05:00
|
|
|
isPrivate Boolean @default(false)
|
2023-05-18 13:02:17 -05:00
|
|
|
whitelistedUsers String[] @default([])
|
2023-02-13 18:09:13 -06:00
|
|
|
createdAt DateTime @default(now())
|
2023-01-31 05:36:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
model Collection {
|
2023-02-13 18:09:13 -06:00
|
|
|
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)
|
2023-06-13 14:19:37 -05:00
|
|
|
|
|
|
|
|
2023-02-13 18:09:13 -06:00
|
|
|
owner User @relation(fields: [ownerId], references: [id])
|
|
|
|
ownerId Int
|
2023-02-24 11:32:28 -06:00
|
|
|
members UsersAndCollections[]
|
2023-02-13 18:09:13 -06:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2023-02-24 11:32:28 -06:00
|
|
|
model UsersAndCollections {
|
2023-01-31 05:36:56 -06:00
|
|
|
user User @relation(fields: [userId], references: [id])
|
2023-02-13 18:09:13 -06:00
|
|
|
userId Int
|
2023-01-31 05:36:56 -06: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-02-13 18:09:13 -06:00
|
|
|
canCreate Boolean
|
|
|
|
canUpdate Boolean
|
|
|
|
canDelete Boolean
|
2023-01-31 05:36:56 -06:00
|
|
|
|
|
|
|
@@id([userId, collectionId])
|
2023-02-13 18:09:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
model Link {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
|
|
|
url String
|
2023-06-13 23:40:23 -05:00
|
|
|
description String @default("")
|
2023-06-13 14:19:37 -05:00
|
|
|
|
|
|
|
pinnedBy User[]
|
|
|
|
|
2023-02-13 18:09:13 -06:00
|
|
|
collection Collection @relation(fields: [collectionId], references: [id])
|
|
|
|
collectionId Int
|
2023-02-24 11:32:28 -06:00
|
|
|
tags Tag[]
|
2023-03-06 14:08:11 -06:00
|
|
|
createdAt DateTime @default(now())
|
2023-02-24 11:32:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
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-02-24 11:32:28 -06:00
|
|
|
|
2023-03-28 02:31:50 -05:00
|
|
|
@@unique([name, ownerId])
|
2023-06-02 06:59:52 -05:00
|
|
|
}
|