49 lines
1.2 KiB
Text
49 lines
1.2 KiB
Text
// 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
|
|
}
|