88 lines
2.4 KiB
Plaintext
88 lines
2.4 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Collection {
|
|
id String @id @default(uuid())
|
|
name String
|
|
description String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
articles Article[] @relation("ArticleCollections")
|
|
quickNotes QuickNote[] @relation("CollectionQuickNotes")
|
|
notes Note[]
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
@@index([userId])
|
|
}
|
|
|
|
model Article {
|
|
id String @id @default(uuid())
|
|
title String
|
|
content String
|
|
source String
|
|
url String @unique
|
|
publishedAt DateTime
|
|
collections Collection[] @relation("ArticleCollections")
|
|
quickNotes QuickNote[] @relation("ArticleQuickNotes")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
categories String[]
|
|
authors String[]
|
|
imageUrl String?
|
|
Note Note[]
|
|
|
|
@@index([url])
|
|
}
|
|
|
|
model QuickNote {
|
|
id String @id @default(uuid())
|
|
title String
|
|
content String
|
|
shared Boolean @default(false)
|
|
sharedVia String?
|
|
collection Collection @relation("CollectionQuickNotes", fields: [collectionId], references: [id])
|
|
collectionId String
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
article Article? @relation("ArticleQuickNotes", fields: [articleId], references: [id])
|
|
articleId String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([collectionId])
|
|
}
|
|
|
|
model Note {
|
|
id String @id @default(uuid())
|
|
title String
|
|
content String
|
|
shared Boolean @default(false)
|
|
sharedVia String?
|
|
collection Collection @relation(fields: [collectionId], references: [id])
|
|
collectionId String
|
|
article Article? @relation(fields: [articleId], references: [id])
|
|
articleId String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
User User? @relation(fields: [userId], references: [id])
|
|
userId String?
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
username String @unique
|
|
password String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
collections Collection[]
|
|
quickNotes QuickNote[]
|
|
notes Note[]
|
|
}
|