Kairo-Jinkendo/backend/migrations/023_action_execution_plan.sql
Lars 1166a0c7f1
All checks were successful
Deploy Development / deploy (push) Successful in 48s
Test Suite / pytest-backend (push) Successful in 2m20s
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 19s
Test Suite / playwright-smoke (push) Successful in 14s
AP1.16a-b: Execution-Graph für Arbeitspaket-Abhängigkeiten.
Migration 023, Engine, API und ADP für Durchführungsplan getrennt vom Gate-Graph; Docs und Sprint-Assignment synchronisiert.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 10:38:01 +02:00

33 lines
1.4 KiB
SQL

-- AP1.16a: Durchführungsplan — Action-Reihenfolge, kind, Abhängigkeiten
ALTER TABLE actions
ADD COLUMN IF NOT EXISTS sort_order INT NOT NULL DEFAULT 0;
ALTER TABLE actions
ADD COLUMN IF NOT EXISTS action_kind VARCHAR(32) NOT NULL DEFAULT 'delivery'
CHECK (action_kind IN ('delivery', 'planning', 'review'));
CREATE INDEX idx_actions_initiative_sort
ON actions(tenant_id, initiative_id, sort_order);
CREATE TABLE action_dependencies (
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,
predecessor_action_id UUID NOT NULL REFERENCES actions(id) ON DELETE CASCADE,
successor_action_id UUID NOT NULL REFERENCES actions(id) ON DELETE CASCADE,
dependency_kind VARCHAR(32) NOT NULL DEFAULT 'requires'
CHECK (dependency_kind IN ('requires', 'blocks', 'relates')),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE (tenant_id, predecessor_action_id, successor_action_id, dependency_kind)
);
CREATE INDEX idx_action_deps_predecessor
ON action_dependencies(tenant_id, predecessor_action_id);
CREATE INDEX idx_action_deps_successor
ON action_dependencies(tenant_id, successor_action_id);
CREATE INDEX idx_action_deps_initiative
ON action_dependencies(tenant_id, initiative_id);