diff options
author | Dave Arter <davea@mysociety.org> | 2016-09-06 15:37:42 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-09-09 14:14:37 +0100 |
commit | 54a2b63fac54d01914fd2bb456da483e6982ee21 (patch) | |
tree | 574fe83a0dcf2cba219d32f440f44cde1dbc3132 /db/schema.sql | |
parent | f8f870be0f9f648b48896cb6411446b7f9e049ce (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.sql')
-rw-r--r-- | db/schema.sql | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/db/schema.sql b/db/schema.sql index c96059fb1..27f4bad13 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -127,6 +127,15 @@ create trigger contacts_update_trigger after update on contacts create trigger contacts_insert_trigger after insert on contacts for each row execute procedure contacts_updated(); +-- Problems can have priorities. This table must be created before problem. +CREATE TABLE response_priorities ( + id serial not null primary key, + body_id int references body(id) not null, + deleted boolean not null default 'f', + name text not null, + unique(body_id, name) +); + -- Problems reported by users of site create table problem ( id serial not null primary key, @@ -185,7 +194,8 @@ create table problem ( extra text, -- extra fields required for open311 flagged boolean not null default 'f', geocode bytea, - + response_priority_id int REFERENCES response_priorities(id), + -- logging sending failures (used by webservices) send_fail_count integer not null default 0, send_fail_reason text, @@ -482,3 +492,9 @@ CREATE TABLE contact_response_templates ( contact_id int REFERENCES contacts(id) NOT NULL, response_template_id int REFERENCES response_templates(id) NOT NULL ); + +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 +); |