v0.6.0 — Kitchen: Pantry & Freezer inventory
This commit is contained in:
15
prisma/migrations/20260629000001_v0_19_pantry/migration.sql
Normal file
15
prisma/migrations/20260629000001_v0_19_pantry/migration.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
-- v0.19 Pantry: add storedAt, source enum, and plantId to Item
|
||||
|
||||
CREATE TYPE "ItemSource" AS ENUM ('GARDEN', 'HOMEMADE', 'STORE', 'FARMERS_MARKET', 'GIFTED', 'OTHER');
|
||||
|
||||
ALTER TABLE "Item"
|
||||
ADD COLUMN "storedAt" TIMESTAMP(3),
|
||||
ADD COLUMN "source" "ItemSource",
|
||||
ADD COLUMN "plantId" TEXT;
|
||||
|
||||
ALTER TABLE "Item"
|
||||
ADD CONSTRAINT "Item_plantId_fkey"
|
||||
FOREIGN KEY ("plantId") REFERENCES "Plant"("id")
|
||||
ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
CREATE INDEX "Item_plantId_idx" ON "Item"("plantId");
|
||||
@@ -165,6 +165,7 @@ model Plant {
|
||||
updatedAt DateTime @updatedAt
|
||||
logs PlantLog[]
|
||||
tasks Task[]
|
||||
pantryItems Item[]
|
||||
|
||||
@@index([category])
|
||||
@@index([zone])
|
||||
@@ -299,7 +300,16 @@ model PlantLog {
|
||||
|
||||
enum ItemKind {
|
||||
DURABLE // tools, gear, equipment — "where is it?"
|
||||
CONSUMABLE // food, feed, supplies — "do I have it?" (Pantry phase)
|
||||
CONSUMABLE // food, feed, supplies — "do I have it?"
|
||||
}
|
||||
|
||||
enum ItemSource {
|
||||
GARDEN // grown/harvested here
|
||||
HOMEMADE // made/preserved ourselves
|
||||
STORE // grocery or big-box store
|
||||
FARMERS_MARKET // local market
|
||||
GIFTED // given by someone
|
||||
OTHER
|
||||
}
|
||||
|
||||
model Item {
|
||||
@@ -338,10 +348,14 @@ model Item {
|
||||
// Custom fields — flexible key/value (e.g. VIN, "Oil Weight": "5W-30")
|
||||
customFields Json?
|
||||
|
||||
// Consumable attributes (Pantry phase)
|
||||
// Consumable attributes
|
||||
barcode String?
|
||||
bestBefore DateTime?
|
||||
storedAt DateTime? // date frozen / preserved / stored
|
||||
bestBefore DateTime? // expiry / best-by date
|
||||
minStock Decimal? @db.Decimal(10, 2)
|
||||
source ItemSource? // where it came from
|
||||
plantId String? // link to a garden plant (harvest source)
|
||||
plant Plant? @relation(fields: [plantId], references: [id], onDelete: SetNull)
|
||||
|
||||
// Shared
|
||||
qrSlug String? @unique // short slug for a printed QR label
|
||||
@@ -362,6 +376,7 @@ model Item {
|
||||
@@index([active])
|
||||
@@index([name])
|
||||
@@index([barcode])
|
||||
@@index([plantId])
|
||||
}
|
||||
|
||||
model Label {
|
||||
|
||||
Reference in New Issue
Block a user