-- Migration: Flight Recorder Support
ALTER TABLE tasting_sessions 
ADD COLUMN IF NOT EXISTS started_at TIMESTAMP WITH TIME ZONE,
ADD COLUMN IF NOT EXISTS ended_at TIMESTAMP WITH TIME ZONE;

ALTER TABLE tastings 
ADD COLUMN IF NOT EXISTS tasted_at TIMESTAMP WITH TIME ZONE;

-- Backfill: Nutze created_at für bestehende Tastings
UPDATE tastings SET tasted_at = created_at WHERE tasted_at IS NULL;

-- Index für schnelleres Sortieren der Timeline
CREATE INDEX IF NOT EXISTS idx_tastings_tasted_at ON tastings(tasted_at);
