{"push_id":1145002455,"size":1,"distinct_size":1,"ref":"refs/heads/repo-id","head":"f6767eb9271ae3ac205229a11d6460371689dd29","before":"01f5113fce3772362c752def3004b0d304b065db","commits":[{"sha":"f6767eb9271ae3ac205229a11d6460371689dd29","author":{"name":"Quinn Slack","email":"d50ab715b206c59d05d16c99513cbab732d054ef@qslack.com"},"message":"use int32 repo IDs in protobuf definitions, not string repo URIs\n\nYou must run the following migration SQL:\n\n  -- not necessary, but recommended to trim old builds so the updates below run faster\n  delete from repo_build where created_at < now() - interval '3 weeks';\n  delete from repo_build_task where created_at < now() - interval '3 weeks';\n\n  begin;\n\n  alter table repo_build drop constraint repo_build_pkey;\n  alter table repo_build add column repo_id integer;\n  update repo_build set repo_id=repo.id from repo where repo_build.repo=repo.uri;\n  alter table repo_build drop column repo;\n  delete from repo_build where repo_id is null;\n  alter table repo_build alter column repo_id set not null;\n  alter table repo_build add primary key(repo_id, id);\n  create index repo_build_successful on repo_build(repo_id, commit_id) where success and not purged;\n  create or replace function increment_build_id() returns trigger immutable as $$\n           begin\n             if new.id = 0 or new.id is null then\n               new.id = (select coalesce(max(b.id), 0) + 1 from repo_build b where b.repo_id=new.repo_id);\n             end if;\n             return new;\n           end\n           $$ language plpgsql;\n  drop trigger repo_build_next_id on repo_build;\n  create trigger repo_build_next_id before insert on repo_build for each row execute procedure increment_build_id();\n  -- intentionally removes repo_build_repo index (which was a prefix match on the pkey, so useless)\n\n  alter table repo_build_task drop constraint repo_build_task_pkey;\n  alter table repo_build_task add column repo_id integer;\n  update repo_build_task set repo_id=repo.id from repo where repo_build_task.repo=repo.uri;\n  alter table repo_build_task drop column repo;\n  delete from repo_build_task where repo_id is null;\n  alter table repo_build_task alter column repo_id set not null;\n  alter table repo_build_task add primary key(repo_id, build_id, id);\n  create or replace function increment_build_task_id() returns trigger immutable as $$\n           begin\n             if new.id = 0 or new.id is null then\n               new.id = (select coalesce(max(t.id), 0) + 1 from repo_build_task t where t.repo_id=new.repo_id and t.build_id=new.build_id);\n             end if;\n             return new;\n           end\n           $$ language plpgsql;\n  drop trigger repo_build_task_next_id on repo_build_task;\n  create trigger repo_build_task_next_id before insert on repo_build_task for each row execute procedure increment_build_task_id();\n\n  commit;","distinct":true,"url":"https://api.github.com/repos/sourcegraph/sourcegraph/commits/f6767eb9271ae3ac205229a11d6460371689dd29"}]}
{"actor":{"display_login":"sqs"}}