aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-11-23 18:40:31 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-11-27 10:40:57 +0000
commitd1c6217e353702440854187495501932f1be31fb (patch)
treebda8f33f21735e9c19cb4be7e2aaca563ef9d717 /db
parentc69891dffcb3810ebb951af4a563c556b2deeb0d (diff)
Associate moderation history with admin log.
Diffstat (limited to 'db')
-rw-r--r--db/downgrade_0065---0064.sql14
-rw-r--r--db/schema.sql1
-rw-r--r--db/schema_0065-add-moderation-admin-log.sql13
3 files changed, 28 insertions, 0 deletions
diff --git a/db/downgrade_0065---0064.sql b/db/downgrade_0065---0064.sql
new file mode 100644
index 000000000..455627b77
--- /dev/null
+++ b/db/downgrade_0065---0064.sql
@@ -0,0 +1,14 @@
+BEGIN;
+
+DELETE FROM admin_log WHERE object_type = 'moderation';
+
+ALTER TABLE admin_log DROP CONSTRAINT admin_log_object_type_check;
+
+ALTER TABLE admin_log ADD CONSTRAINT admin_log_object_type_check CHECK (
+ object_type = 'problem'
+ OR object_type = 'update'
+ OR object_type = 'user'
+);
+
+COMMIT;
+
diff --git a/db/schema.sql b/db/schema.sql
index d5d63f478..c97e8d585 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -427,6 +427,7 @@ create table admin_log (
object_type = 'problem'
or object_type = 'update'
or object_type = 'user'
+ or object_type = 'moderation'
),
object_id integer not null,
action text not null,
diff --git a/db/schema_0065-add-moderation-admin-log.sql b/db/schema_0065-add-moderation-admin-log.sql
new file mode 100644
index 000000000..9a5385db7
--- /dev/null
+++ b/db/schema_0065-add-moderation-admin-log.sql
@@ -0,0 +1,13 @@
+BEGIN;
+
+ALTER TABLE admin_log DROP CONSTRAINT admin_log_object_type_check;
+
+ALTER TABLE admin_log ADD CONSTRAINT admin_log_object_type_check CHECK (
+ object_type = 'problem'
+ OR object_type = 'update'
+ OR object_type = 'user'
+ OR object_type = 'moderation'
+);
+
+COMMIT;
+