add env config, and create base schema for prisma
This commit is contained in:
parent
789daa854a
commit
5aa8ca01e9
|
|
@ -0,0 +1 @@
|
||||||
|
DATABASE_URL='<database_url>'
|
||||||
|
|
@ -24,4 +24,5 @@ dist-ssr
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
*.sqlite
|
*.sqlite
|
||||||
*.db
|
*.db
|
||||||
|
.env
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
generator client {
|
||||||
|
provider = "prisma-client-js"
|
||||||
|
previewFeatures = ["referentialIntegrity"]
|
||||||
|
}
|
||||||
|
|
||||||
|
datasource db {
|
||||||
|
provider = "mysql"
|
||||||
|
url = env("DATABASE_URL")
|
||||||
|
referentialIntegrity = "prisma"
|
||||||
|
}
|
||||||
|
|
||||||
|
model User {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
firstname String
|
||||||
|
lastname String
|
||||||
|
email String
|
||||||
|
password String
|
||||||
|
posts Post[]
|
||||||
|
roleId Int
|
||||||
|
Role Role @relation(fields: [roleId], references: [id])
|
||||||
|
}
|
||||||
|
|
||||||
|
model Role {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
name String
|
||||||
|
users User[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model Post {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
title String
|
||||||
|
content String
|
||||||
|
image String
|
||||||
|
authorId Int
|
||||||
|
author User @relation(fields: [authorId], references: [id])
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue