2021-10-24 04:18:18 +02:00
|
|
|
datasource db {
|
|
|
|
provider = "postgres"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
|
|
|
id Int @id @default(autoincrement())
|
2021-10-26 16:01:49 +02:00
|
|
|
name String @unique @db.VarChar(30)
|
|
|
|
email String? @unique @db.VarChar(254)
|
2021-10-24 04:18:18 +02:00
|
|
|
password String? @db.Text
|
|
|
|
logo String? @db.Text
|
2021-10-26 16:01:49 +02:00
|
|
|
status String? @db.VarChar(50)
|
|
|
|
biography String? @db.VarChar(160)
|
2021-10-24 04:18:18 +02:00
|
|
|
website String? @db.VarChar(255)
|
|
|
|
isConfirmed Boolean @default(false)
|
|
|
|
temporaryToken String?
|
|
|
|
temporaryExpirationToken DateTime?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
settings UserSetting?
|
|
|
|
refreshTokens RefreshToken[]
|
|
|
|
oauths OAuth[]
|
|
|
|
members Member[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model UserSetting {
|
|
|
|
id Int @id @default(autoincrement())
|
2021-10-26 16:01:49 +02:00
|
|
|
language String @default("en") @db.VarChar(10)
|
|
|
|
theme String @default("dark") @db.VarChar(10)
|
2021-10-24 04:18:18 +02:00
|
|
|
isPublicEmail Boolean @default(false)
|
|
|
|
isPublicGuilds Boolean @default(false)
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
userId Int @unique
|
2022-02-19 20:08:25 +01:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-10-24 04:18:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model RefreshToken {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
token String @db.Text
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2021-12-29 12:44:16 +01:00
|
|
|
userId Int
|
2022-02-19 20:08:25 +01:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-10-24 04:18:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model OAuth {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
providerId String @db.Text
|
2021-10-26 16:01:49 +02:00
|
|
|
provider String @db.VarChar(20)
|
2021-10-24 04:18:18 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2021-12-29 12:44:16 +01:00
|
|
|
userId Int
|
2022-02-19 20:08:25 +01:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-10-24 04:18:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model Member {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
isOwner Boolean @default(false)
|
|
|
|
Message Message[]
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2021-12-28 22:52:28 +01:00
|
|
|
userId Int
|
2022-02-19 20:08:25 +01:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-12-28 22:52:28 +01:00
|
|
|
guildId Int
|
2022-02-19 20:08:25 +01:00
|
|
|
guild Guild? @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
2021-10-24 04:18:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model Guild {
|
|
|
|
id Int @id @default(autoincrement())
|
2021-10-26 16:01:49 +02:00
|
|
|
name String @db.VarChar(30)
|
2021-10-24 04:18:18 +02:00
|
|
|
icon String? @db.Text
|
|
|
|
description String? @db.Text
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
members Member[]
|
|
|
|
channels Channel[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model Channel {
|
|
|
|
id Int @id @default(autoincrement())
|
2021-10-26 16:01:49 +02:00
|
|
|
name String @db.VarChar(20)
|
2021-10-24 04:18:18 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2021-12-28 22:52:28 +01:00
|
|
|
guildId Int
|
2022-02-19 20:08:25 +01:00
|
|
|
guild Guild? @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
2021-10-24 04:18:18 +02:00
|
|
|
messages Message[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model Message {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
value String @db.Text
|
2021-10-26 16:01:49 +02:00
|
|
|
type String @default("text") @db.VarChar(10)
|
|
|
|
mimetype String @default("text/plain") @db.VarChar(127)
|
2021-10-24 04:18:18 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2021-12-28 22:52:28 +01:00
|
|
|
memberId Int
|
2022-02-19 20:08:25 +01:00
|
|
|
member Member? @relation(fields: [memberId], references: [id], onDelete: Cascade)
|
2021-12-28 22:52:28 +01:00
|
|
|
channelId Int
|
2022-02-19 20:08:25 +01:00
|
|
|
channel Channel? @relation(fields: [channelId], references: [id], onDelete: Cascade)
|
2021-10-24 04:18:18 +02:00
|
|
|
}
|