aboutsummaryrefslogtreecommitdiffstats
path: root/db/schema_0009-update_alerts_problem_state_queries.sql
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-09-21 11:41:23 +0100
committerStruan Donald <struan@exo.org.uk>2011-09-21 11:41:23 +0100
commitd941a8c26e943c941f8e37ecbd9a9982dd41cb70 (patch)
tree75ea20fb18e984912ba60e4e499114c83cf431fe /db/schema_0009-update_alerts_problem_state_queries.sql
parent9da2d7b0e806407e3ed5e5418a53fca64757a39a (diff)
parent77f31e8c96c727ea5ab9cf217cfd924074e8f3ed (diff)
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into js-validation
Conflicts: templates/web/default/report/display.html
Diffstat (limited to 'db/schema_0009-update_alerts_problem_state_queries.sql')
-rw-r--r--db/schema_0009-update_alerts_problem_state_queries.sql28
1 files changed, 28 insertions, 0 deletions
diff --git a/db/schema_0009-update_alerts_problem_state_queries.sql b/db/schema_0009-update_alerts_problem_state_queries.sql
new file mode 100644
index 000000000..fc5de927a
--- /dev/null
+++ b/db/schema_0009-update_alerts_problem_state_queries.sql
@@ -0,0 +1,28 @@
+begin;
+
+ UPDATE alert_type set item_where = 'nearby.problem_id = problem.id and problem.state in
+ (''confirmed'', ''investigating'', ''planned'', ''in progress'',
+ ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'')' WHERE ref = 'postcode_local_problems';
+ UPDATE alert_type set item_where = 'problem.state in
+ (''confirmed'', ''investigating'', ''planned'', ''in progress'',
+ ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'' )' WHERE ref = 'new_problems';
+ UPDATE alert_type set item_where = 'problem.state in (''fixed'', ''fixed - user'', ''fixed - council'')' WHERE ref = 'new_fixed_problems';
+ UPDATE alert_type set item_where = 'nearby.problem_id = problem.id and problem.state in
+ (''confirmed'', ''investigating'', ''planned'', ''in progress'',
+ ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'')' WHERE ref = 'local_problems';
+ UPDATE alert_type set item_where = 'problem.state in
+ (''confirmed'', ''investigating'', ''planned'', ''in progress'',
+ ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and
+ (council like ''%''||?||''%'' or council is null) and
+ areas like ''%,''||?||'',%''' WHERE ref = 'council_problems';
+ UPDATE alert_type set item_where = 'problem.state in
+ (''confirmed'', ''investigating'', ''planned'', ''in progress'',
+ ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and
+ (council like ''%''||?||''%'' or council is null) and
+ areas like ''%,''||?||'',%''' WHERE ref = 'ward_problems';
+ UPDATE alert_type set item_where = 'problem.state in
+ (''confirmed'', ''investigating'', ''planned'', ''in progress'',
+ ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and
+ areas like ''%,''||?||'',%''' WHERE ref = 'area_problems';
+
+commit;