-- ECR-039 FunnelDefinition (read catalog) CREATE TABLE IF NOT EXISTS funnel_definitions ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), code varchar(64) NOT NULL UNIQUE, title varchar(128) NOT NULL, active boolean NOT NULL DEFAULT true, system boolean NOT NULL DEFAULT false, created_at timestamptz NOT NULL DEFAULT now(), updated_at timestamptz NOT NULL DEFAULT now() ); CREATE INDEX IF NOT EXISTS idx_funnel_definitions_active ON funnel_definitions(active); INSERT INTO funnel_definitions(code, title, active, system) VALUES ('signup_to_ask', '注册到问答漏斗占位', true, true) ON CONFLICT (code) DO NOTHING;