kiwi/app/db/migrations/003_receipt_data.sql
pyr0ball 8cbde774e5 chore: initial commit — kiwi Phase 2 complete
Pantry tracker app with:
- FastAPI backend + Vue 3 SPA frontend
- SQLite via circuitforge-core (migrations 001-005)
- Inventory CRUD, barcode scan, receipt OCR pipeline
- Expiry prediction (deterministic + LLM fallback)
- CF-core tier system integration
- Cloud session support (menagerie)
2026-03-30 22:20:48 -07:00

38 lines
1.5 KiB
SQL

-- Migration 003: OCR receipt data table (ported from Alembic 54cddaf4f4e2)
CREATE TABLE IF NOT EXISTS receipt_data (
id INTEGER PRIMARY KEY AUTOINCREMENT,
receipt_id INTEGER NOT NULL UNIQUE
REFERENCES receipts (id) ON DELETE CASCADE,
merchant_name TEXT,
merchant_address TEXT,
merchant_phone TEXT,
merchant_email TEXT,
merchant_website TEXT,
merchant_tax_id TEXT,
transaction_date TEXT,
transaction_time TEXT,
receipt_number TEXT,
register_number TEXT,
cashier_name TEXT,
transaction_id TEXT,
items TEXT NOT NULL DEFAULT '[]',
subtotal REAL,
tax REAL,
discount REAL,
tip REAL,
total REAL,
payment_method TEXT,
amount_paid REAL,
change_given REAL,
raw_text TEXT,
confidence_scores TEXT NOT NULL DEFAULT '{}',
warnings TEXT NOT NULL DEFAULT '[]',
processing_time REAL,
created_at TEXT NOT NULL DEFAULT (datetime('now')),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_receipt_data_receipt_id ON receipt_data (receipt_id);
CREATE INDEX IF NOT EXISTS idx_receipt_data_merchant ON receipt_data (merchant_name);
CREATE INDEX IF NOT EXISTS idx_receipt_data_date ON receipt_data (transaction_date);