CREATE TABLE IF NOT EXISTS worktrees (
    id          TEXT PRIMARY KEY,
    run_id      TEXT NOT NULL,
    path        TEXT NOT NULL,
    branch      TEXT NOT NULL,
    created_at  INTEGER NOT NULL,
    removed_at  INTEGER,
    FOREIGN KEY (run_id) REFERENCES runs(id) ON DELETE CASCADE
);

CREATE INDEX IF NOT EXISTS idx_worktrees_run ON worktrees(run_id);
