app/: production port — Postgres + Prisma + OTM-account auth (v0.2.0)
Prototype stays untouched (Bonna's laptop daily driver until cutover). app/ is the deployable bms-backbone: same routes/frontend, Prisma models replacing node:sqlite, session-cookie login backed by a User table seeded via the platform SEED_OWNER_* convention (bcryptjs), /api/health with APP_VERSION, photos/files under DATA_DIR (/app/data uploads mount), Dockerfile + entrypoint (prisma db push + owner seed + serve), and a one-shot sqlite→postgres migration script for Bonna's existing data. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
160
app/prisma/schema.prisma
Normal file
160
app/prisma/schema.prisma
Normal file
@@ -0,0 +1,160 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
email String @unique
|
||||
passwordHash String
|
||||
role String @default("OWNER")
|
||||
created DateTime @default(now())
|
||||
}
|
||||
|
||||
model Note {
|
||||
id Int @id @default(autoincrement())
|
||||
text String
|
||||
tags String @default("")
|
||||
created DateTime @default(now())
|
||||
}
|
||||
|
||||
model Todo {
|
||||
id Int @id @default(autoincrement())
|
||||
text String
|
||||
done Boolean @default(false)
|
||||
parentId Int?
|
||||
created DateTime @default(now())
|
||||
}
|
||||
|
||||
model Shopping {
|
||||
id Int @id @default(autoincrement())
|
||||
text String
|
||||
done Boolean @default(false)
|
||||
created DateTime @default(now())
|
||||
}
|
||||
|
||||
model Glaze {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
kind String @default("glaze")
|
||||
cone String @default("")
|
||||
atmosphere String @default("")
|
||||
surface String @default("")
|
||||
source String @default("mine")
|
||||
sg String @default("")
|
||||
swatch String @default("")
|
||||
created DateTime @default(now())
|
||||
materials GlazeMaterial[]
|
||||
journal GlazeJournal[]
|
||||
}
|
||||
|
||||
model GlazeMaterial {
|
||||
id Int @id @default(autoincrement())
|
||||
glazeId Int
|
||||
glaze Glaze @relation(fields: [glazeId], references: [id], onDelete: Cascade)
|
||||
name String
|
||||
pct Float
|
||||
addition Boolean @default(false)
|
||||
}
|
||||
|
||||
model GlazeJournal {
|
||||
id Int @id @default(autoincrement())
|
||||
glazeId Int
|
||||
glaze Glaze @relation(fields: [glazeId], references: [id], onDelete: Cascade)
|
||||
text String
|
||||
created DateTime @default(now())
|
||||
}
|
||||
|
||||
model Firing {
|
||||
id Int @id @default(autoincrement())
|
||||
type String @default("glaze")
|
||||
cone String @default("∆6")
|
||||
schedule String @default("")
|
||||
status String @default("firing")
|
||||
resultNotes String @default("")
|
||||
started DateTime @default(now())
|
||||
unloaded DateTime?
|
||||
items FiringItem[]
|
||||
}
|
||||
|
||||
model FiringItem {
|
||||
id Int @id @default(autoincrement())
|
||||
firingId Int
|
||||
firing Firing @relation(fields: [firingId], references: [id], onDelete: Cascade)
|
||||
piece String
|
||||
clay String @default("")
|
||||
glaze String @default("")
|
||||
rating String @default("")
|
||||
note String @default("")
|
||||
}
|
||||
|
||||
model Photo {
|
||||
id Int @id @default(autoincrement())
|
||||
entity String
|
||||
entityId Int
|
||||
filename String
|
||||
created DateTime @default(now())
|
||||
}
|
||||
|
||||
model FileAsset {
|
||||
id Int @id @default(autoincrement())
|
||||
entity String @default("")
|
||||
entityId Int @default(0)
|
||||
stored String
|
||||
name String
|
||||
tag String @default("")
|
||||
size Int @default(0)
|
||||
created DateTime @default(now())
|
||||
}
|
||||
|
||||
model Product {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
kind String @default("core line")
|
||||
category String @default("")
|
||||
price Float @default(0)
|
||||
cost Float @default(0)
|
||||
qty Int @default(0)
|
||||
status String @default("in progress")
|
||||
notes String @default("")
|
||||
created DateTime @default(now())
|
||||
sales Sale[]
|
||||
}
|
||||
|
||||
model Sale {
|
||||
id Int @id @default(autoincrement())
|
||||
productId Int
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
qty Int @default(1)
|
||||
price Float @default(0)
|
||||
cost Float @default(0)
|
||||
created DateTime @default(now())
|
||||
}
|
||||
|
||||
model Supplier {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
kind String @default("online")
|
||||
distance String @default("")
|
||||
url String @default("")
|
||||
notes String @default("")
|
||||
searchUrl String @default("")
|
||||
created DateTime @default(now())
|
||||
prices PriceEntry[]
|
||||
}
|
||||
|
||||
model PriceEntry {
|
||||
id Int @id @default(autoincrement())
|
||||
item String
|
||||
supplierId Int
|
||||
supplier Supplier @relation(fields: [supplierId], references: [id], onDelete: Cascade)
|
||||
price Float
|
||||
unit String @default("")
|
||||
shipping Float @default(0)
|
||||
note String @default("")
|
||||
created DateTime @default(now())
|
||||
}
|
||||
Reference in New Issue
Block a user