-- Add worktree tracking to contracts
-- Each contract now has a single worktree managed by a specific daemon

ALTER TABLE contracts
    ADD COLUMN worktree_path VARCHAR(512),
    ADD COLUMN worktree_daemon_id UUID REFERENCES daemons(id),
    ADD COLUMN worktree_base_branch VARCHAR(255),
    ADD COLUMN worktree_branch VARCHAR(255);

COMMENT ON COLUMN contracts.worktree_path IS 'Path to the worktree directory on the assigned daemon';
COMMENT ON COLUMN contracts.worktree_daemon_id IS 'The daemon that owns/manages this contract worktree';
COMMENT ON COLUMN contracts.worktree_base_branch IS 'The base branch the worktree was created from';
COMMENT ON COLUMN contracts.worktree_branch IS 'The working branch in the worktree';
