forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0036-migration.sql
23 lines (20 loc) · 989 Bytes
/
0036-migration.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
begin
-- lock this table before reading from it, to prevent loss of concurrent
-- updates when the table is dropped. Note that this may lead to concurrent
-- updates failing; the important thing is that they not succeed without
-- taking effect. Failed updates will be retried.
lock table taskcluster_integration_owners_entities;
create table github_integrations
as
select
(value ->> 'owner')::text as owner,
(value ->> 'installationId')::integer as installation_id
from taskcluster_integration_owners_entities;
alter table github_integrations add primary key (owner);
alter table github_integrations
alter column owner set not null,
alter column installation_id set not null;
revoke select, insert, update, delete on taskcluster_integration_owners_entities from $db_user_prefix$_github;
drop table taskcluster_integration_owners_entities;
grant select, insert, update, delete on github_integrations to $db_user_prefix$_github;
end