-- 实验漏斗事件只接受受信决策ID,不接受前台指定组别。 CREATE TABLE IF NOT EXISTS dh_events ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, experiment_id VARCHAR(64) NOT NULL, decision_id VARCHAR(64) NOT NULL, account VARCHAR(80) NOT NULL, variant VARCHAR(20) NOT NULL, cohort ENUM('random','manual') NOT NULL, event_name ENUM('conversation_started','message_sent','reply_complete','reply_stopped','reply_failed') NOT NULL, conversation_id VARCHAR(64) NOT NULL, request_id VARCHAR(64) NOT NULL, created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), UNIQUE KEY uk_dh_event(experiment_id,account,event_name,request_id), KEY idx_dh_events_funnel(experiment_id,variant,cohort,event_name) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;