update prisma schema

This commit is contained in:
Guillaume Dorce 2022-08-19 16:05:28 +02:00
parent 43393b3fd3
commit d94f22a3dc
1 changed files with 14 additions and 13 deletions

View File

@ -1,6 +1,7 @@
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
output = "../.prisma/client"
}
datasource db {
@ -13,24 +14,24 @@ model User {
id Int @id @default(autoincrement())
firstname String
lastname String
email String
email String @unique
password String
posts Post[]
roleId Int
Role Role @relation(fields: [roleId], references: [id])
role Role @default(USER)
}
model Role {
id Int @id @default(autoincrement())
name String
users User[]
enum Role {
USER
ADMIN
}
model Post {
id Int @id @default(autoincrement())
title String
content String
image String
authorId Int
author User @relation(fields: [authorId], references: [id])
id Int @id @default(autoincrement())
title String
content String?
image String?
authorId Int
author User @relation(fields: [authorId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}