This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
api/prisma/schema.prisma

106 lines
3.5 KiB
Plaintext
Raw Normal View History

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())
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
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())
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
user User? @relation(fields: [userId], references: [id])
}
model RefreshToken {
id Int @id @default(autoincrement())
token String @db.Text
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
userId Int
2021-10-24 04:18:18 +02:00
user User? @relation(fields: [userId], references: [id])
}
model OAuth {
id Int @id @default(autoincrement())
providerId String @db.Text
provider String @db.VarChar(20)
2021-10-24 04:18:18 +02:00
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
userId Int
2021-10-24 04:18:18 +02:00
user User? @relation(fields: [userId], references: [id])
}
model Member {
id Int @id @default(autoincrement())
isOwner Boolean @default(false)
Message Message[]
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
userId Int
2021-10-24 04:18:18 +02:00
user User? @relation(fields: [userId], references: [id])
guildId Int
2021-10-24 04:18:18 +02:00
guild Guild? @relation(fields: [guildId], references: [id])
}
model Guild {
id Int @id @default(autoincrement())
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())
name String @db.VarChar(20)
2021-10-24 04:18:18 +02:00
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
guildId Int
2021-10-24 04:18:18 +02:00
guild Guild? @relation(fields: [guildId], references: [id])
messages Message[]
}
model Message {
id Int @id @default(autoincrement())
value String @db.Text
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
memberId Int
2021-10-24 04:18:18 +02:00
member Member? @relation(fields: [memberId], references: [id])
channelId Int
2021-10-24 04:18:18 +02:00
channel Channel? @relation(fields: [channelId], references: [id])
}