Revert "Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table""

This commit is contained in:
Venus Bailey
2017-10-16 16:24:34 +01:00
committed by GitHub
parent e9b76d7d75
commit 9b60d69931
8 changed files with 135 additions and 17 deletions

View File

@@ -305,3 +305,27 @@ class PopulateServiceLetterContact(Command):
db.session.commit()
print("Populated letter contacts for {} services".format(result.rowcount))
class PopulateServiceAndServiceHistoryFreeSmsFragmentLimit(Command):
def run(self):
services_to_update = """
UPDATE services
SET free_sms_fragment_limit = 250000
WHERE free_sms_fragment_limit IS NULL
"""
services_history_to_update = """
UPDATE services_history
SET free_sms_fragment_limit = 250000
WHERE free_sms_fragment_limit IS NULL
"""
services_result = db.session.execute(services_to_update)
services_history_result = db.session.execute(services_history_to_update)
db.session.commit()
print("Populated free sms fragment limits for {} services".format(services_result.rowcount))
print("Populated free sms fragment limits for {} services history".format(services_history_result.rowcount))