mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 09:21:39 -05:00
Merge pull request #1193 from alphagov/ken-update-inbound_numbers-service_id
Update inbound_numbers to services that have sms_sender in inbound_numbers
This commit is contained in:
@@ -151,6 +151,20 @@ class CustomDbScript(Command):
|
||||
db.session.commit()
|
||||
result = db.session.execute(subq_hist).fetchall()
|
||||
|
||||
def link_inbound_numbers_to_service(self):
|
||||
update = """
|
||||
UPDATE inbound_numbers SET
|
||||
service_id = services.id,
|
||||
updated_at = now()
|
||||
FROM services
|
||||
WHERE services.sms_sender = inbound_numbers.number AND
|
||||
inbound_numbers.service_id is null
|
||||
"""
|
||||
result = db.session.execute(update)
|
||||
db.session.commit()
|
||||
|
||||
print("Linked {} inbound numbers to service".format(result.rowcount))
|
||||
|
||||
|
||||
class PopulateMonthlyBilling(Command):
|
||||
option_list = (
|
||||
|
||||
Reference in New Issue
Block a user