mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-23 15:56:45 -04:00
Add db command to update inbound_numbers
Updates the service_id with the service.id that matches the sms_sender
This commit is contained in:
@@ -151,6 +151,19 @@ class CustomDbScript(Command):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
result = db.session.execute(subq_hist).fetchall()
|
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
|
||||||
|
"""
|
||||||
|
result = db.session.execute(update)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
print("Linked {} inbound numbers to service".format(result.rowcount))
|
||||||
|
|
||||||
|
|
||||||
class PopulateMonthlyBilling(Command):
|
class PopulateMonthlyBilling(Command):
|
||||||
option_list = (
|
option_list = (
|
||||||
|
|||||||
Reference in New Issue
Block a user