From 4b25654cbf30c0d31d29df174a843548b06ab9c3 Mon Sep 17 00:00:00 2001 From: venusbb Date: Wed, 21 Mar 2018 15:37:49 +0000 Subject: [PATCH] update record rather than ignore when duplicate --- app/commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/commands.py b/app/commands.py index 5e778601f..4e49f6e02 100644 --- a/app/commands.py +++ b/app/commands.py @@ -443,7 +443,10 @@ def migrate_data_to_ft_billing(start_date, end_date): group by bst_date, template_id, service_id, notification_type, provider, rate_multiplier, international, sms_rate, letter_rate order by bst_date - on conflict do nothing + on conflict on constraint ft_billing_pkey do update set + billable_units = excluded.billable_units, + notifications_sent = excluded.notifications_sent, + rate = excluded.rate """.format(process_date, process_date + timedelta(days=1)) result = db.session.execute(sql)