81 lines
1.7 KiB
Plaintext
81 lines
1.7 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
output = "../node_modules/.prisma/client/"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
model User {
|
|
id String @id
|
|
username String @unique
|
|
|
|
posts Post[]
|
|
comments Comment[]
|
|
notifications Notification[]
|
|
sessions Session[]
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model Post {
|
|
id Int @id @default(autoincrement())
|
|
created DateTime @default(now())
|
|
|
|
description String?
|
|
images Image[]
|
|
comments Comment[]
|
|
|
|
author User? @relation(fields: [author_id], references: [id], onDelete: Cascade)
|
|
author_id String?
|
|
|
|
@@map("posts")
|
|
}
|
|
|
|
model Image {
|
|
id Int @id @default(autoincrement())
|
|
filename String
|
|
|
|
post Post @relation(fields: [post_id], references: [id], onDelete: Cascade)
|
|
post_id Int
|
|
|
|
@@map("images")
|
|
}
|
|
|
|
model Comment {
|
|
id Int @id @default(autoincrement())
|
|
created DateTime @default(now())
|
|
|
|
text String
|
|
|
|
post Post @relation(fields: [post_id], references: [id], onDelete: Cascade)
|
|
post_id Int
|
|
|
|
author User @relation(fields: [author_id], references: [id], onDelete: Cascade)
|
|
author_id String
|
|
|
|
@@map("comments")
|
|
}
|
|
|
|
model Notification {
|
|
id Int @id @default(autoincrement())
|
|
text String
|
|
href String?
|
|
|
|
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
user_id String
|
|
|
|
@@map("notifications")
|
|
}
|
|
|
|
model Session {
|
|
token String @id
|
|
|
|
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
user_id String
|
|
|
|
created DateTime @default(now())
|
|
|
|
@@map("sessions")
|
|
} |