summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-11-07 15:44:55 +0100
committerYorhel <git@yorhel.nl>2021-11-07 15:45:03 +0100
commit8c1fcdb94b46373c4e9c8d533e645edf6aba6f7a (patch)
tree63a08451cec8be2741e609d82157032364881bc7 /util
parent1ed63d7ba7b9d22300d15828dce142c2d5d1c15d (diff)
Add mod option to set deletion reason for forum posts
Diffstat (limited to 'util')
-rw-r--r--util/updates/2021-11-07-posts-hidden-msg.sql17
1 files changed, 17 insertions, 0 deletions
diff --git a/util/updates/2021-11-07-posts-hidden-msg.sql b/util/updates/2021-11-07-posts-hidden-msg.sql
new file mode 100644
index 00000000..878ae0ab
--- /dev/null
+++ b/util/updates/2021-11-07-posts-hidden-msg.sql
@@ -0,0 +1,17 @@
+BEGIN;
+ALTER TABLE threads_posts
+ DROP CONSTRAINT threads_posts_first_nonhidden,
+ ALTER COLUMN hidden DROP NOT NULL,
+ ALTER COLUMN hidden DROP DEFAULT,
+ ALTER COLUMN hidden TYPE text USING case when hidden then '' else null end,
+ ADD CONSTRAINT threads_posts_first_nonhidden CHECK(num > 1 OR hidden IS NULL);
+
+ALTER TABLE reviews_posts
+ ALTER COLUMN hidden DROP NOT NULL,
+ ALTER COLUMN hidden DROP DEFAULT,
+ ALTER COLUMN hidden TYPE text USING case when hidden then '' else null end;
+
+\i sql/func.sql
+COMMIT;
+
+\i sql/triggers.sql