From a0b974f4ac41d17143c3bdee7ee935644a572cd1 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 25 May 2016 09:13:32 +0100 Subject: [PATCH] Remove the status from the group by clause of the update statement. This script has been applied to all environments except live, this can be pushed through to live without issue because of how alembic works. --- migrations/versions/0021_add_delivered_failed_counts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migrations/versions/0021_add_delivered_failed_counts.py b/migrations/versions/0021_add_delivered_failed_counts.py index 641026785..41069b954 100644 --- a/migrations/versions/0021_add_delivered_failed_counts.py +++ b/migrations/versions/0021_add_delivered_failed_counts.py @@ -26,13 +26,13 @@ def upgrade(): if x.job_id: op.execute("update jobs set notifications_delivered = (" "select count(status) from notifications where status = 'delivered' and job_id = '{}' " - "group by status, job_id)" + "group by job_id)" "where jobs.id = '{}'".format(x.job_id, x.job_id)) op.execute("update jobs set notifications_failed = (" "select count(status) from notifications " "where status in ('failed','technical-failure', 'temporary-failure', 'permanent-failure') " - "and job_id = '{}' group by status, job_id)" + "and job_id = '{}' group by job_id)" "where jobs.id = '{}'".format(x.job_id, x.job_id)) op.execute("update jobs set notifications_delivered = 0 where notifications_delivered is null") op.execute("update jobs set notifications_failed = 0 where notifications_failed is null")