aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-11-05 16:33:51 +0000
committerMatthew Somerville <matthew@mysociety.org>2019-11-08 15:31:39 +0000
commit7a39608ab48c8fd3fa2c5a8061b42ee8f9869973 (patch)
treeaa51d01235cde53fd408348f2439121e22beab65 /db
parenteb68c3fa83ce8796a69429c83adedddba64c7cdc (diff)
Add admin log entry for more objects and things.
Namely templates, roles, bodies, categories, various user edits, and when using the inspect form and changing category.
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;
+