20 lines · 1.1 KB
-- Branch protection: force pushes (non-fast-forward updates) are denied on protected refs unless allowed.
ALTER TABLE branch_protections ADD COLUMN allow_force_pushes INTEGER NOT NULL DEFAULT 0;

-- Set on forks whose (transitive) parent was private when it was deleted, so they can never be made public.
ALTER TABLE repos ADD COLUMN private_network INTEGER NOT NULL DEFAULT 0;

-- Hidden-ref drops still owed after a visibility change; retried by the cron until they succeed.
CREATE TABLE hidden_ref_cleanups (
  repo_id TEXT PRIMARY KEY REFERENCES repos(id) ON DELETE CASCADE,
  attempts INTEGER NOT NULL DEFAULT 0,
  requested_at INTEGER NOT NULL,
  next_attempt_at INTEGER NOT NULL DEFAULT 0
);

-- Set once a pull bridge has written base objects (refs/gitfor/*) into a head repo; upload-pack then only serves visible tips
-- forever, since bridged objects stay fetchable by SHA until Artifacts garbage-collects them.
ALTER TABLE repos ADD COLUMN bridged_into INTEGER NOT NULL DEFAULT 0;
UPDATE repos SET bridged_into = 1
  WHERE id IN (SELECT head_repo_id FROM pull_requests WHERE head_repo_id != repo_id);