bliss/api/prisma/schema.prisma

71 lines
1.7 KiB
Plaintext
Raw Normal View History

2022-12-15 07:34:09 +00:00
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
2022-12-17 06:08:19 +00:00
provider = "prisma-client-js"
2022-12-15 07:34:09 +00:00
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
2022-12-25 07:45:18 +00:00
id String @id @default(uuid())
username String @unique
image String?
email String @unique
disabled Boolean @default(false)
password String
role Role @default(USER)
createdAt DateTime @default(now()) @map("created_at")
emailVerified DateTime? @map("email_verified")
invitedBy String? @map("invited_by")
apiKey String @unique @default(cuid()) @map("api_key")
uploadLimit Int @default(500) @map("upload_limit")
2022-12-15 07:34:09 +00:00
embed_settings EmbedSettings?
2022-12-25 07:45:18 +00:00
files File[]
2022-12-15 07:34:09 +00:00
@@map("users")
}
model EmbedSettings {
2022-12-21 09:56:45 +00:00
id String @id @default(cuid())
enabled Boolean @default(false)
provider_name String?
provider_url String?
author_name String?
author_url String?
title String?
description String?
color String
2022-12-15 07:34:09 +00:00
2022-12-21 09:56:45 +00:00
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
2022-12-15 07:34:09 +00:00
userId String @unique @map("user_id")
@@map("embed_settings")
}
model File {
id String @id @default(cuid())
filename String
mimetype String
slug String @unique
size Int
createdAt DateTime @default(now()) @map("created_at")
2022-12-17 06:08:19 +00:00
views Int @default(0)
2022-12-15 07:34:09 +00:00
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String @map("user_id")
@@unique([userId, slug])
@@map("files")
}
enum Role {
OWNER
ADMIN
USER
}