-- 回滚 0018：丢弃指针表与 verdict 列，恢复三阶段 CHECK。
-- implementing/reviewing 产物在回滚时若存在会违反旧 CHECK，先删除它们（旧 schema 无处安放）。
DROP TABLE IF EXISTS requirement_phase_pointers;

ALTER TABLE requirement_artifacts DROP COLUMN IF EXISTS verdict;

DELETE FROM requirement_artifacts WHERE phase IN ('implementing','reviewing');
ALTER TABLE requirement_artifacts DROP CONSTRAINT requirement_artifacts_phase_check;
ALTER TABLE requirement_artifacts ADD CONSTRAINT requirement_artifacts_phase_check
  CHECK (phase IN ('planning','prototyping','auditing'));
