auth-service/prisma/schema.prisma

56 lines
1.2 KiB
Plaintext

generator client {
provider = "prisma-client"
output = "./generated"
moduleFormat = "cjs"
}
datasource db {
provider = "postgresql"
}
model Account {
id String @id @default(nanoid())
phone String? @unique
email String? @unique
isPhoneVerified Boolean @default(false) @map("is_phone_verified")
isEmailVerified Boolean @default(false) @map("is_email_verified")
pendingContactChanges PendingContactChange[]
role Role @default(USER)
telegramId String? @unique @map("telegram_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("accounts")
}
model PendingContactChange {
id String @id @default(nanoid())
type String
value String
codeHash String @map("code_hash")
expiresAt DateTime @map("expires_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
accountId String @map("account_id")
@@unique([accountId, type])
@@map("pending_contact_changes")
}
enum Role {
ADMIN
USER
@@map("roles")
}