17 lines
832 B
SQL
17 lines
832 B
SQL
-- Pipeline V2: Add columns for 3-phase analysis pipeline
|
|
-- Phase 1 (discover-channels) → Phase 2 (collect-channel-data) → Phase 3 (generate-report)
|
|
|
|
ALTER TABLE marketing_reports
|
|
ADD COLUMN IF NOT EXISTS status TEXT DEFAULT 'pending',
|
|
ADD COLUMN IF NOT EXISTS verified_channels JSONB DEFAULT '{}',
|
|
ADD COLUMN IF NOT EXISTS channel_data JSONB DEFAULT '{}',
|
|
ADD COLUMN IF NOT EXISTS pipeline_started_at TIMESTAMPTZ,
|
|
ADD COLUMN IF NOT EXISTS pipeline_completed_at TIMESTAMPTZ,
|
|
ADD COLUMN IF NOT EXISTS error_message TEXT;
|
|
|
|
-- Mark all existing rows as complete (they were generated by the old pipeline)
|
|
UPDATE marketing_reports SET status = 'complete' WHERE status IS NULL OR status = 'pending';
|
|
|
|
-- Index for frontend polling
|
|
CREATE INDEX IF NOT EXISTS idx_marketing_reports_status ON marketing_reports(id, status);
|