aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2015-08-19 15:44:02 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2015-08-19 15:46:16 +0100
commitefa106c52e2668715d17b860a8afa71501691185 (patch)
tree510aba995e818f5500b980b2a904a3e790b0b1c8 /db
parentad81d87a957b5590fbcba3f2325526a9cddcbb7f (diff)
Move "missing" handling to separate column.
Diffstat (limited to 'db')
-rw-r--r--db/schema.sql1
-rw-r--r--db/schema_0035-bodies_str-tidying.sql10
2 files changed, 11 insertions, 0 deletions
diff --git a/db/schema.sql b/db/schema.sql
index 609a1445d..5d42d57cf 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -132,6 +132,7 @@ create table problem (
latitude double precision not null,
longitude double precision not null,
bodies_str text, -- the body(s) we'll report this problem to
+ bodies_missing text, -- the body(s) we had no contact details for
areas text not null, -- the mapit areas this location is in
category text not null default 'Other',
title text not null,
diff --git a/db/schema_0035-bodies_str-tidying.sql b/db/schema_0035-bodies_str-tidying.sql
new file mode 100644
index 000000000..c4c7badaf
--- /dev/null
+++ b/db/schema_0035-bodies_str-tidying.sql
@@ -0,0 +1,10 @@
+begin;
+
+alter table problem add bodies_missing text;
+
+update problem
+ set bodies_missing = split_part(bodies_str, '|', 2),
+ bodies_str = split_part(bodies_str, '|', 1)
+ where bodies_str like '%|%';
+
+commit;