aboutsummaryrefslogtreecommitdiffstats
path: root/db/schema.sql
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-08-22 15:21:29 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-08-29 09:54:36 +0100
commitb43813d8f3c5bae07f0c7b9fe120bff32611d8bb (patch)
treed685c3acef3a487c666304f64d30c36d213daffa /db/schema.sql
parentb43dbace0f747897640920e4cf9adb55b84bc2c8 (diff)
Add state table to database.
Diffstat (limited to 'db/schema.sql')
-rw-r--r--db/schema.sql42
1 files changed, 9 insertions, 33 deletions
diff --git a/db/schema.sql b/db/schema.sql
index ed930a13e..12e66b53a 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -177,24 +177,7 @@ create table problem (
-- Metadata
created timestamp not null default current_timestamp,
confirmed timestamp,
- state text not null check (
- state = 'unconfirmed'
- or state = 'confirmed'
- or state = 'investigating'
- or state = 'planned'
- or state = 'in progress'
- or state = 'action scheduled'
- or state = 'closed'
- or state = 'fixed'
- or state = 'fixed - council'
- or state = 'fixed - user'
- or state = 'hidden'
- or state = 'partial'
- or state = 'unable to fix'
- or state = 'not responsible'
- or state = 'duplicate'
- or state = 'internal referral'
- ),
+ state text not null,
lang text not null default 'en-gb',
service text not null default '',
cobrand text not null default '' check (cobrand ~* '^[a-z0-9_]*$'),
@@ -327,21 +310,7 @@ create table comment (
cobrand_data text not null default '' check (cobrand_data ~* '^[a-z0-9_]*$'), -- Extra data used in cobranded versions of the site
mark_fixed boolean not null,
mark_open boolean not null default 'f',
- problem_state text check (
- problem_state = 'confirmed'
- or problem_state = 'investigating'
- or problem_state = 'planned'
- or problem_state = 'in progress'
- or problem_state = 'action scheduled'
- or problem_state = 'closed'
- or problem_state = 'fixed'
- or problem_state = 'fixed - council'
- or problem_state = 'fixed - user'
- or problem_state = 'unable to fix'
- or problem_state = 'not responsible'
- or problem_state = 'duplicate'
- or problem_state = 'internal referral'
- ),
+ problem_state text,
-- other fields? one to indicate whether this was written by the council
-- and should be highlighted in the display?
external_id text,
@@ -546,3 +515,10 @@ CREATE TABLE report_extra_fields (
language text,
extra text
);
+
+CREATE TABLE state (
+ id serial not null primary key,
+ label text not null unique,
+ type text not null check (type = 'open' OR type = 'closed'),
+ name text not null unique
+);