mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 17:52:26 -05:00
Add command to populate the free_sms_fragment_limit
Added a one-off command to set values of the free_sms_fragment_limit in the services table and the services_history table to the default of 250000.
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -21,6 +21,8 @@ manager.add_command('backfill_processing_time', commands.BackfillProcessingTime)
|
||||
manager.add_command('populate_service_email_reply_to', commands.PopulateServiceEmailReplyTo)
|
||||
manager.add_command('populate_service_sms_sender', commands.PopulateServiceSmsSender)
|
||||
manager.add_command('populate_service_letter_contact', commands.PopulateServiceLetterContact)
|
||||
manager.add_command('populate_service_and_service_history_free_sms_fragment_limit',
|
||||
commands.PopulateServiceAndServiceHistoryFreeSmsFragmentLimit)
|
||||
|
||||
|
||||
@manager.command
|
||||
|
||||
Reference in New Issue
Block a user