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