Kairo-Jinkendo/backend/migrations/021_roadmap_plan_snapshots.sql
Lars 064779e187
Some checks failed
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Failing after 2m18s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
AP1.14: Plan-Snapshot und Plan/Ist-Overlay in Kontrolle.
Revisionen mit Audit, getrennte Soll/Ist/Diff-Ansicht unter Kontrolle/Plan-Ist; API plan-ist-view und plan-snapshots.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 08:10:15 +02:00

18 lines
799 B
SQL

-- AP1.14: Plan-Snapshots (Plan-Revision) — Soll-Zustand getrennt von Ist
CREATE TABLE roadmap_plan_snapshots (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
initiative_id UUID NOT NULL REFERENCES initiatives(id) ON DELETE CASCADE,
roadmap_id UUID NOT NULL REFERENCES roadmaps(id) ON DELETE CASCADE,
revision_number INT NOT NULL,
reason TEXT NOT NULL DEFAULT '',
plan_payload JSONB NOT NULL,
created_by_user_id UUID NULL REFERENCES users(id) ON DELETE SET NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE (tenant_id, initiative_id, revision_number)
);
CREATE INDEX idx_roadmap_plan_snapshots_initiative
ON roadmap_plan_snapshots(tenant_id, initiative_id, created_at DESC);