Kairo-Jinkendo/backend/migrations/026_sprint_planning_kinds.sql

27 lines
1.0 KiB
MySQL
Raw Permalink Normal View History

-- AP2.2e: Sprint-Planung — Item-Arten, Feature-Referenz, Unplan-Support
ALTER TABLE actions DROP CONSTRAINT IF EXISTS actions_action_kind_check;
ALTER TABLE actions
ADD CONSTRAINT actions_action_kind_check
CHECK (action_kind IN ('delivery', 'planning', 'review', 'bug', 'issue'));
ALTER TABLE actions
ADD COLUMN IF NOT EXISTS parent_action_id UUID NULL
REFERENCES actions (id) ON DELETE SET NULL;
CREATE INDEX IF NOT EXISTS idx_actions_parent
ON actions (tenant_id, initiative_id, parent_action_id)
WHERE parent_action_id IS NOT NULL;
ALTER TABLE backlog_items
ADD COLUMN IF NOT EXISTS item_kind VARCHAR(32) NOT NULL DEFAULT 'story'
CHECK (item_kind IN ('story', 'bug', 'issue'));
ALTER TABLE backlog_items
ADD COLUMN IF NOT EXISTS parent_action_id UUID NULL
REFERENCES actions (id) ON DELETE SET NULL;
CREATE INDEX IF NOT EXISTS idx_backlog_parent_action
ON backlog_items (tenant_id, initiative_id, parent_action_id)
WHERE parent_action_id IS NOT NULL;