aboutsummaryrefslogtreecommitdiffstats
path: root/db/schema_0072-add-staff-contact-state.sql
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-02-17 17:43:54 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-02-26 11:40:15 +0000
commit18adbe946c1104338e6abff159b4f9877154969c (patch)
tree5bae6c894981d3d90724f75c241c9d1e4c848dc2 /db/schema_0072-add-staff-contact-state.sql
parent97133a07a181e6cccc207cc6598a08e8028ad7ca (diff)
Add a new "staff" contact state.
This state will appear when reporting if you are logged in as a staff member of the relevant body, but otherwise not appear on the site.
Diffstat (limited to 'db/schema_0072-add-staff-contact-state.sql')
-rw-r--r--db/schema_0072-add-staff-contact-state.sql23
1 files changed, 23 insertions, 0 deletions
diff --git a/db/schema_0072-add-staff-contact-state.sql b/db/schema_0072-add-staff-contact-state.sql
new file mode 100644
index 000000000..efaac2d20
--- /dev/null
+++ b/db/schema_0072-add-staff-contact-state.sql
@@ -0,0 +1,23 @@
+BEGIN;
+
+ALTER TABLE contacts DROP CONSTRAINT contacts_state_check;
+
+ALTER TABLE contacts ADD CONSTRAINT contacts_state_check CHECK (
+ state = 'unconfirmed'
+ or state = 'confirmed'
+ or state = 'inactive'
+ or state = 'staff'
+ or state = 'deleted'
+);
+
+ALTER TABLE contacts_history DROP CONSTRAINT contacts_history_state_check;
+
+ALTER TABLE contacts_history ADD CONSTRAINT contacts_history_state_check CHECK (
+ state = 'unconfirmed'
+ or state = 'confirmed'
+ or state = 'inactive'
+ or state = 'staff'
+ or state = 'deleted'
+);
+
+COMMIT;