CREATE TABLE IF NOT EXISTS repo_branch_protect (
    id BIGSERIAL PRIMARY KEY,
    repo_uuid UUID NOT NULL,
    branch VARCHAR(255) NOT NULL,
    forbid_push BOOLEAN NOT NULL DEFAULT false,
    forbid_pull BOOLEAN NOT NULL DEFAULT false,
    forbid_merge BOOLEAN NOT NULL DEFAULT false,
    forbid_deletion BOOLEAN NOT NULL DEFAULT false,
    forbid_force_push BOOLEAN NOT NULL DEFAULT false,
    forbid_tag_push BOOLEAN NOT NULL DEFAULT false,
    UNIQUE (repo_uuid, branch)
);

CREATE UNIQUE INDEX idx_repo_branch_protect_repo_branch ON repo_branch_protect (repo_uuid, branch);
