From 112f64f1c75b19b65cce701754f2f43cea0edcf4 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 5 Sep 2020 10:09:50 +0200 Subject: Notifications: Modernize SQL schema By removing the ltype, using the vndbid type, renaming 'subid' to 'num' (as used elsewhere) and removing the reference to uid=0. --- util/updates/2020-09-05-notifications.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 util/updates/2020-09-05-notifications.sql (limited to 'util') diff --git a/util/updates/2020-09-05-notifications.sql b/util/updates/2020-09-05-notifications.sql new file mode 100644 index 00000000..864824e3 --- /dev/null +++ b/util/updates/2020-09-05-notifications.sql @@ -0,0 +1,10 @@ +ALTER TABLE notifications ALTER COLUMN iid TYPE vndbid USING vndbid(ltype::text, iid); +ALTER TABLE notifications RENAME COLUMN subid TO num; +ALTER TABLE notifications DROP COLUMN ltype; +ALTER TABLE notifications ALTER COLUMN c_byuser DROP DEFAULT; +ALTER TABLE notifications ALTER COLUMN c_byuser DROP NOT NULL; +DROP TYPE notification_ltype; +UPDATE notifications SET c_byuser = NULL WHERE c_byuser = 0; + +\i sql/func.sql +\i sql/triggers.sql -- cgit v1.2.3