feat: unify tasting form refactor & align db schema status levels

This commit is contained in:
2025-12-23 22:13:05 +01:00
parent 6a41667f9c
commit 11275dd875
11 changed files with 570 additions and 442 deletions

11
migration_v2.sql Normal file
View File

@@ -0,0 +1,11 @@
-- Run this in your Supabase SQL Editor if you have an older database version
-- 1. Add columns if they don't exist
ALTER TABLE bottles ADD COLUMN IF NOT EXISTS status TEXT DEFAULT 'sealed';
ALTER TABLE bottles ADD COLUMN IF NOT EXISTS purchase_price DECIMAL(10, 2);
ALTER TABLE bottles ADD COLUMN IF NOT EXISTS finished_at TIMESTAMP WITH TIME ZONE;
-- 2. Add check constraint for status
-- Note: We drop it first in case it exists with different values
ALTER TABLE bottles DROP CONSTRAINT IF EXISTS bottles_status_check;
ALTER TABLE bottles ADD CONSTRAINT bottles_status_check CHECK (status IN ('sealed', 'open', 'sampled', 'empty'));