-- ADR-092 P1 Learning Chain Rollback
-- 撤銷 adr092_p1_learning_chain_fix.sql 的所有變更
-- 僅在 schema 誤套 / 緊急回滾時使用；資料不可復原
--
-- 執行方式（需人工執行一次）：
--   psql $DATABASE_URL -f apps/api/migrations/adr092_p1_learning_chain_rollback.sql
--
-- 2026-04-25 db-expert-fix by Claude Engineer-B

BEGIN;

DROP INDEX IF EXISTS ix_approval_matched_playbook;
ALTER TABLE approval_records DROP COLUMN IF EXISTS matched_playbook_id;

DROP INDEX IF EXISTS ix_timeline_incident_id;
ALTER TABLE timeline_events DROP COLUMN IF EXISTS incident_id;

COMMIT;
