summaryrefslogtreecommitdiff
path: root/util/updates/update_2.16.sql
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-12-23 14:25:37 +0100
committerYorhel <git@yorhel.nl>2010-12-23 14:25:37 +0100
commit3eb574e4e26162aa754372fff806e4c6de8f4754 (patch)
tree32b08348512dc2f16d932676bb9b1b61fab16f3a /util/updates/update_2.16.sql
parent6ff1efe0d07e24e9fb2db199c308c6cbed51e578 (diff)
Converted the notify_announce and notify_dbedit preferences
And renamed notify_dbedit to notify_nodbedit, since the default is to provide a notify on a database edit. Also fixed a few bugs along the way.
Diffstat (limited to 'util/updates/update_2.16.sql')
-rw-r--r--util/updates/update_2.16.sql24
1 files changed, 16 insertions, 8 deletions
diff --git a/util/updates/update_2.16.sql b/util/updates/update_2.16.sql
index b401a7a4..c1b3358b 100644
--- a/util/updates/update_2.16.sql
+++ b/util/updates/update_2.16.sql
@@ -50,7 +50,7 @@ ALTER TABLE rlists RENAME COLUMN rstat TO status;
-- add users_prefs table
-CREATE TYPE prefs_key AS ENUM ('l10n', 'skin', 'customcss', 'show_nsfw', 'hide_list', 'notify_dbedit', 'notify_announce');
+CREATE TYPE prefs_key AS ENUM ('l10n', 'skin', 'customcss', 'show_nsfw', 'hide_list', 'notify_nodbedit', 'notify_announce');
CREATE TABLE users_prefs (
uid integer NOT NULL REFERENCES users (id) ON DELETE CASCADE,
key prefs_key NOT NULL,
@@ -61,15 +61,23 @@ CREATE TABLE users_prefs (
-- convert from users.* to users_prefs
INSERT INTO users_prefs (uid, key, value)
SELECT id, 'skin'::prefs_key, skin FROM users WHERE skin <> ''
- UNION
- SELECT id, 'customcss', customcss FROM users WHERE customcss <> '';
- UNION
- SELECT id, 'show_nsfw'::prefs_key, '1' FROM users WHERE show_nsfw;
- UNION
- SELECT id, 'hide_list'::prefs_key, '1' FROM users WHERE NOT show_list;
-
+ UNION ALL
+ SELECT id, 'customcss', customcss FROM users WHERE customcss <> ''
+ UNION ALL
+ SELECT id, 'show_nsfw', '1' FROM users WHERE show_nsfw
+ UNION ALL
+ SELECT id, 'hide_list', '1' FROM users WHERE NOT show_list
+ UNION ALL
+ SELECT id, 'notify_nodbedit', '1' FROM users WHERE NOT notify_dbedit
+ UNION ALL
+ SELECT id, 'notify_announce', '1' FROM users WHERE notify_announce;
+
+-- remove unused columns from the user table
ALTER TABLE users DROP COLUMN skin;
ALTER TABLE users DROP COLUMN customcss;
ALTER TABLE users DROP COLUMN show_nsfw;
ALTER TABLE users DROP COLUMN show_list;
+ALTER TABLE users DROP COLUMN notify_dbedit;
+ALTER TABLE users DROP COLUMN notify_announce;
+