- Dockerfile 单阶段 Alpine 镜像,使用国内镜像(npmmirror / Prisma 引擎 / apk)加速 - entrypoint 首次复制内置图章素材到 uploads volume,自动执行 prisma migrate deploy - docker-compose.yml 绑定 127.0.0.1:3001,强制走外部 Nginx 反代 - Express 在 production 下同时托管 packages/web/dist 及 SPA fallback - Prisma schema 增加 linux-musl 二进制目标,支持 Alpine 运行 - 新增 DEPLOY.md 部署指南,含 .env 模板与 Nginx 反代示例 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
69 lines
1.8 KiB
Plaintext
69 lines
1.8 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
username String @unique
|
|
phone String @unique
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
collections Collection[]
|
|
redemptions Redemption[]
|
|
}
|
|
|
|
model Stamp {
|
|
id String @id @default(uuid())
|
|
name String
|
|
note String?
|
|
imageColor String
|
|
imageGrey String
|
|
sortOrder Int @default(0)
|
|
enabled Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
collections Collection[]
|
|
}
|
|
|
|
model Collection {
|
|
id String @id @default(uuid())
|
|
userId String
|
|
stampId String
|
|
collectedAt DateTime @default(now())
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
stamp Stamp @relation(fields: [stampId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([userId, stampId])
|
|
@@index([userId])
|
|
}
|
|
|
|
model RedemptionRule {
|
|
id String @id @default(uuid())
|
|
name String
|
|
description String?
|
|
threshold Int
|
|
enabled Boolean @default(true)
|
|
sortOrder Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
redemptions Redemption[]
|
|
}
|
|
|
|
model Redemption {
|
|
id String @id @default(uuid())
|
|
userId String
|
|
ruleId String
|
|
stampCount Int
|
|
redeemedAt DateTime @default(now())
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
rule RedemptionRule @relation(fields: [ruleId], references: [id])
|
|
|
|
@@index([userId])
|
|
}
|