aboutsummaryrefslogtreecommitdiffstats
path: root/db/schema_0045-response-priorities.sql
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-09-06 15:37:42 +0100
committerDave Arter <davea@mysociety.org>2016-09-09 14:14:37 +0100
commit54a2b63fac54d01914fd2bb456da483e6982ee21 (patch)
tree574fe83a0dcf2cba219d32f440f44cde1dbc3132 /db/schema_0045-response-priorities.sql
parentf8f870be0f9f648b48896cb6411446b7f9e049ce (diff)
Refactor problem response priority into its own model
This moves the response priority values from a cobrand-specific method to a full DB model, and includes management screens in the admin for administering them. For mysociety/fixmystreetforcouncils#66
Diffstat (limited to 'db/schema_0045-response-priorities.sql')
-rw-r--r--db/schema_0045-response-priorities.sql20
1 files changed, 20 insertions, 0 deletions
diff --git a/db/schema_0045-response-priorities.sql b/db/schema_0045-response-priorities.sql
new file mode 100644
index 000000000..16215e40c
--- /dev/null
+++ b/db/schema_0045-response-priorities.sql
@@ -0,0 +1,20 @@
+BEGIN;
+
+CREATE TABLE response_priorities (
+ id serial not null primary key,
+ body_id int references body(id) not null,
+ name text not null,
+ deleted boolean not null default 'f',
+ unique(body_id, name)
+);
+
+CREATE TABLE contact_response_priorities (
+ id serial NOT NULL PRIMARY KEY,
+ contact_id int REFERENCES contacts(id) NOT NULL,
+ response_priority_id int REFERENCES response_priorities(id) NOT NULL
+);
+
+ALTER TABLE problem
+ ADD COLUMN response_priority_id int REFERENCES response_priorities(id);
+
+COMMIT;