Files
payme/prisma/schema.prisma
2026-03-27 19:35:14 +01:00

129 lines
3.2 KiB
Plaintext

generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum PaymentMethodType {
PAYPAL
BITCOIN
ETHEREUM
MONERO
LITECOIN
SOLANA
USDT
REVOLUT
BANK_TRANSFER
CUSTOM
}
model User {
id String @id @default(cuid())
email String @unique
hashedPassword String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
profile Profile?
accounts Account[]
sessions Session[]
}
model Profile {
id String @id @default(cuid())
userId String @unique
username String @unique
displayName String
bio String?
avatarUrl String?
themeId String
isPublic Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
theme Theme @relation(fields: [themeId], references: [id])
paymentMethods PaymentMethod[]
socialLinks SocialLink[]
@@index([username])
}
model Theme {
id String @id
name String
description String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
profiles Profile[]
}
model PaymentMethod {
id String @id @default(cuid())
profileId String
type PaymentMethodType
label String
value String
network String?
description String?
sortOrder Int @default(0)
isVisible Boolean @default(true)
metadata Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
@@index([profileId, sortOrder])
}
model SocialLink {
id String @id @default(cuid())
profileId String
label String
url String
sortOrder Int @default(0)
isVisible Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
@@index([profileId, sortOrder])
}
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
}
model Session {
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
}