Ajouts des models avec schema.prisma
This commit is contained in:
parent
431c77f970
commit
1f5342998b
1 changed files with 49 additions and 0 deletions
49
prisma/schema.prisma
Normal file
49
prisma/schema.prisma
Normal file
|
@ -0,0 +1,49 @@
|
|||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
pseudo String @unique
|
||||
nom String
|
||||
prenom String
|
||||
email String @unique
|
||||
password String
|
||||
canaux Canal[] @relation("UserCanaux")
|
||||
messages Message[]
|
||||
|
||||
@@map("users") // Table name in DB
|
||||
}
|
||||
|
||||
model Canal {
|
||||
id Int @id @default(autoincrement())
|
||||
nom String
|
||||
domaine String
|
||||
users User[] @relation("UserCanaux")
|
||||
messages Message[]
|
||||
|
||||
@@map("canaux") // Table name in DB
|
||||
}
|
||||
|
||||
model Message {
|
||||
id Int @id @default(autoincrement())
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
canal Canal @relation(fields: [canalId], references: [id])
|
||||
canalId Int
|
||||
text String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@map("messages") // Table name in DB
|
||||
}
|
Loading…
Add table
Reference in a new issue