forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0017-migration.sql
25 lines (22 loc) · 1.11 KB
/
0017-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
24
25
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 denylisted_notification_entities;
create table denylisted_notifications
as
select
(value ->> 'notificationType')::text as notification_type,
(value ->> 'notificationAddress')::text as notification_address,
etag
from denylisted_notification_entities;
alter table denylisted_notifications add primary key (notification_type, notification_address);
alter table denylisted_notifications
alter column notification_type set not null,
alter column notification_address set not null,
alter column etag set default public.gen_random_uuid();
revoke select, insert, update, delete on denylisted_notification_entities from $db_user_prefix$_notify;
drop table denylisted_notification_entities;
grant select, insert, update, delete on denylisted_notifications to $db_user_prefix$_notify;
end