diff options
author | Yorhel <git@yorhel.nl> | 2020-09-05 10:09:50 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-09-05 10:09:52 +0200 |
commit | 112f64f1c75b19b65cce701754f2f43cea0edcf4 (patch) | |
tree | 7012fea846ec32f4bbf83ee5baf74595fe6225fd /util | |
parent | 818f2aa2cf67526d5d1bd2b34ebf77ce342dc8c4 (diff) |
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.
Diffstat (limited to 'util')
-rw-r--r-- | util/updates/2020-09-05-notifications.sql | 10 |
1 files changed, 10 insertions, 0 deletions
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 |