-- Add parent_item_id to vorlage items (self-referential)
ALTER TABLE checklist_vorlage_items
  ADD COLUMN parent_item_id INT REFERENCES checklist_vorlage_items(id) ON DELETE CASCADE;

CREATE INDEX idx_vorlage_items_parent ON checklist_vorlage_items(parent_item_id);

-- Add parent_ausfuehrung_item_id to execution items (self-referential)
ALTER TABLE checklist_ausfuehrung_items
  ADD COLUMN parent_ausfuehrung_item_id INT REFERENCES checklist_ausfuehrung_items(id) ON DELETE CASCADE;

CREATE INDEX idx_ausfuehrung_items_parent ON checklist_ausfuehrung_items(parent_ausfuehrung_item_id);
