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
|
|
|
}
|
|
|
|
|
2023-07-12 13:26:34 -05:00
|
|
|
model Account {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
userId Int
|
|
|
|
type String
|
|
|
|
provider String
|
|
|
|
providerAccountId String
|
|
|
|
refresh_token String? @db.Text
|
|
|
|
access_token String? @db.Text
|
|
|
|
expires_at Int?
|
|
|
|
token_type String?
|
|
|
|
scope String?
|
|
|
|
id_token String? @db.Text
|
|
|
|
session_state String?
|
|
|
|
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([provider, providerAccountId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model Session {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
sessionToken String @unique
|
|
|
|
userId Int
|
|
|
|
expires DateTime
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
}
|
2023-07-08 05:35:43 -05:00
|
|
|
|
2023-01-31 05:36:56 -06:00
|
|
|
model User {
|
2023-07-15 21:15:43 -05:00
|
|
|
id Int @id @default(autoincrement())
|
2023-07-08 05:35:43 -05:00
|
|
|
name String
|
|
|
|
|
|
|
|
username String @unique
|
|
|
|
|
2023-07-15 21:15:43 -05:00
|
|
|
email String? @unique
|
2023-07-08 05:35:43 -05:00
|
|
|
emailVerified DateTime?
|
|
|
|
image String?
|
2023-06-13 14:19:37 -05:00
|
|
|
|
2023-07-12 13:26:34 -05:00
|
|
|
accounts Account[]
|
|
|
|
sessions Session[]
|
2023-06-13 14:19:37 -05:00
|
|
|
|
2023-07-08 05:35:43 -05:00
|
|
|
password String
|
|
|
|
collections Collection[]
|
|
|
|
|
|
|
|
tags Tag[]
|
|
|
|
|
|
|
|
pinnedLinks Link[]
|
|
|
|
|
|
|
|
collectionsJoined UsersAndCollections[]
|
|
|
|
isPrivate Boolean @default(false)
|
|
|
|
whitelistedUsers String[] @default([])
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
}
|
|
|
|
|
|
|
|
model VerificationToken {
|
|
|
|
identifier String
|
|
|
|
token String @unique
|
|
|
|
expires DateTime
|
|
|
|
|
|
|
|
@@unique([identifier, token])
|
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
|
|
|
}
|