v0.6.0 — Kitchen: Pantry & Freezer inventory

This commit is contained in:
Bonna Moon
2026-06-29 17:28:28 -05:00
parent f483630419
commit 0d52ea5ad1
12 changed files with 784 additions and 8 deletions

View 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");

View File

@@ -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 {