aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-11-10 19:27:06 +0000
committerMatthew Somerville <matthew@mysociety.org>2019-11-10 19:27:06 +0000
commitd8dd060a4c2f75e89a24f99634d91a6d8ef0e2bc (patch)
treeabb543c32c9e5f239cc66cff1bafa697f322ebd3 /db
parentdb61249c59a96a2fad80523288b7d13881c10965 (diff)
parentb886792181eb77206054e73315a9d14cdb17e936 (diff)
Merge branch 'admin-auditing'
Diffstat (limited to 'db')
-rw-r--r--db/schema.sql4
-rw-r--r--db/schema_0069-admin-log-types.sql17
2 files changed, 21 insertions, 0 deletions
diff --git a/db/schema.sql b/db/schema.sql
index a211ef50d..cf2914467 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -445,6 +445,10 @@ create table admin_log (
or object_type = 'update'
or object_type = 'user'
or object_type = 'moderation'
+ or object_type = 'template'
+ or object_type = 'body'
+ or object_type = 'category'
+ or object_type = 'role'
),
object_id integer not null,
action text not null,
diff --git a/db/schema_0069-admin-log-types.sql b/db/schema_0069-admin-log-types.sql
new file mode 100644
index 000000000..e4e9362ac
--- /dev/null
+++ b/db/schema_0069-admin-log-types.sql
@@ -0,0 +1,17 @@
+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'
+ OR object_type = 'template'
+ OR object_type = 'body'
+ OR object_type = 'category'
+ OR object_type = 'role'
+);
+
+COMMIT;
+