-- Stacked pull requests: a pull request is stacked when its base branch is another open pull request's -- head branch in the same repository. `stacked_on_issue_id` remembers the parent after it merges and -- the child is retargeted, so the stack stays visible. `restack_upstream_sha` is the parent tip the -- child was last built on, kept while the parent moves so a restack replays only the child's commits. ALTER TABLE pull_requests ADD COLUMN stacked_on_issue_id TEXT REFERENCES issues(id) ON DELETE SET NULL; ALTER TABLE pull_requests ADD COLUMN restack_upstream_sha TEXT; CREATE INDEX pull_requests_stacked_on ON pull_requests(stacked_on_issue_id) WHERE stacked_on_issue_id IS NOT NULL;