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-20 15:14:29 +0100
committerStruan Donald <struan@exo.org.uk>2011-09-20 15:14:29 +0100
commit227163b2ae15f90707c8e8d9be26daea6c7d2474 (patch)
tree9fa7687a5e977374d5c9286b4d094071e39f6e39 /db/schema_0009-update_alerts_problem_state_queries.sql
parent3a05b6e399de926decfe732a8bff9f4e80fc39c5 (diff)
update alert where clauses with extra states
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;