46 lines
911 B
Plaintext
46 lines
911 B
Plaintext
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client"
|
|
output = "./generated"
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
email String @unique
|
|
name String?
|
|
role Role @default(USER)
|
|
posts Post[]
|
|
profile Profile?
|
|
}
|
|
|
|
model Profile {
|
|
id Int @id @default(autoincrement())
|
|
bio String
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int @unique
|
|
}
|
|
|
|
model Post {
|
|
id Int @id @default(autoincrement())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
title String
|
|
published Boolean @default(false)
|
|
author User @relation(fields: [authorId], references: [id])
|
|
authorId Int
|
|
categories Category[]
|
|
}
|
|
|
|
model Category {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
posts Post[]
|
|
}
|
|
|
|
enum Role {
|
|
USER
|
|
ADMIN
|
|
} |