原型阶段

This commit is contained in:
2026-06-09 23:44:31 +08:00
parent ea1d0fb3bd
commit 01b3375395
22 changed files with 1077 additions and 27 deletions
@@ -0,0 +1,6 @@
DROP TABLE IF EXISTS requirement_prototypes;
-- 回滚前把 prototyping 行归并到 planning,否则重建不含 prototyping 的 CHECK 会失败。
UPDATE requirements SET phase = 'planning' WHERE phase = 'prototyping';
ALTER TABLE requirements DROP CONSTRAINT requirements_phase_check;
ALTER TABLE requirements ADD CONSTRAINT requirements_phase_check
CHECK (phase IN ('planning','auditing','implementing','reviewing','done'));
@@ -0,0 +1,15 @@
ALTER TABLE requirements DROP CONSTRAINT requirements_phase_check;
ALTER TABLE requirements ADD CONSTRAINT requirements_phase_check
CHECK (phase IN ('planning','prototyping','auditing','implementing','reviewing','done'));
CREATE TABLE requirement_prototypes (
id UUID PRIMARY KEY,
requirement_id UUID NOT NULL REFERENCES requirements(id) ON DELETE CASCADE,
version INT NOT NULL,
content TEXT NOT NULL,
note TEXT NOT NULL DEFAULT '',
created_by UUID NOT NULL REFERENCES users(id) ON DELETE RESTRICT,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
UNIQUE (requirement_id, version)
);
CREATE INDEX idx_requirement_prototypes_req ON requirement_prototypes(requirement_id);