twitch-clone/backend/prisma/schema.prisma
2025-07-07 06:16:58 +03:00

66 lines
1.9 KiB
Plaintext

generator client {
provider = "prisma-client-js"
output = "./generated"
}
datasource db {
provider = "postgresql"
url = env("POSTGRES_URI")
}
model SocialLink {
id String @id @default(uuid())
title String
url String
position Int
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String? @map("user_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("social_links")
}
model User {
id String @id @default(uuid())
email String @unique
password String
name String @unique
displayName String @map("display_name")
avatar String?
bio String?
token Token[]
isVerified Boolean @default(false) @map("is_verified")
isEmailVerified Boolean @default(false) @map("is_email_verified")
isTotpEnabled Boolean @default(false) @map("is_totp_enabled")
isDeactivated Boolean @default(false) @map("is_deactivated")
deactivatedAt DateTime? @map("deactivated_at")
socialLink SocialLink[]
totpSecret String? @map("totp_secret")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("users")
}
model Token {
id String @id @default(uuid())
token String @unique
type TokenType
expiresIn DateTime @map("expires_in")
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String? @map("user_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("tokens")
}
enum TokenType {
EMAIL_VERIFY
PASSWORD_RESET
DEACTIVATE_ACCOUNT
@@map("token_types")
}