-- Add continue_from_task_id column for task continuation
-- This allows subtasks to start from another task's worktree

ALTER TABLE tasks ADD COLUMN continue_from_task_id UUID REFERENCES tasks(id) ON DELETE SET NULL;

-- Add index for efficient lookup
CREATE INDEX idx_tasks_continue_from ON tasks(continue_from_task_id) WHERE continue_from_task_id IS NOT NULL;

-- Add copy_files column for copying specific files from parent worktree
-- This is a JSON array of file paths relative to the worktree root
ALTER TABLE tasks ADD COLUMN copy_files JSONB DEFAULT NULL;
