Plant registry, grow event calendar, and gardening knowledge base populated via cf-harvest ingest endpoint. All 23 tests passing. Stack: - FastAPI + SQLite (cf-core migrations) on port 8522 - Vue 3 + Vite + Pinia SPA on port 8521 - 5 SQL migrations: locations → plants → grow_events, knowledge_sources → knowledge_facts - Earthy green theme (--color-primary: #4a7c59) matching CF theme system Knowledge ingest contract: - POST /api/v1/knowledge/ingest — idempotent on fact_hash (sha256 of type+payload+video_path) - 8 fact types: companion_planting, soil_amendment, propagation, pest_diagnosis, harvest_timing, instruction, medicinal, history_context - Partial batch failure: malformed facts collected in rejected[], valid facts inserted - Re-ingesting same video batch: facts_skipped_duplicate > 0, no duplicates Wired views: RegistryView (plant CRUD), KnowledgeView (facts + type filter chips) Stub views: CalendarView, SettingsView
21 lines
930 B
SQL
21 lines
930 B
SQL
-- Migration 003: grow event log (backs calendar and harvest history)
|
|
|
|
CREATE TABLE IF NOT EXISTS grow_events (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
plant_id INTEGER NOT NULL REFERENCES plants(id) ON DELETE CASCADE,
|
|
event_type TEXT NOT NULL
|
|
CHECK (event_type IN (
|
|
'planted', 'watered', 'fed', 'pruned', 'sprayed',
|
|
'observation', 'harvest', 'repotted', 'note'
|
|
)),
|
|
event_date TEXT NOT NULL,
|
|
value_num REAL,
|
|
value_unit TEXT,
|
|
note TEXT,
|
|
photo_path TEXT,
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_grow_events_plant_id ON grow_events (plant_id);
|
|
CREATE INDEX IF NOT EXISTS idx_grow_events_event_date ON grow_events (event_date DESC);
|
|
CREATE INDEX IF NOT EXISTS idx_grow_events_type ON grow_events (event_type);
|