2022-08-29 19:10:56 -07:00
|
|
|
"""empty message
|
|
|
|
|
|
|
|
|
|
Revision ID: 0375_fix_service_name
|
|
|
|
|
Revises: 0374_fix_reg_template_history
|
|
|
|
|
Create Date: 2022-08-29 11:04:15.888017
|
|
|
|
|
|
|
|
|
|
"""
|
2024-04-01 15:12:33 -07:00
|
|
|
|
2023-07-14 14:59:23 -07:00
|
|
|
from sqlalchemy import text
|
2022-08-29 19:10:56 -07:00
|
|
|
|
2023-08-29 14:54:30 -07:00
|
|
|
revision = "0375_fix_service_name"
|
|
|
|
|
down_revision = "0374_fix_reg_template_history"
|
2022-08-29 19:10:56 -07:00
|
|
|
|
|
|
|
|
from alembic import op
|
2022-10-03 17:16:59 -07:00
|
|
|
from flask import current_app
|
2022-08-29 19:10:56 -07:00
|
|
|
|
2023-08-29 14:54:30 -07:00
|
|
|
service_id = current_app.config["NOTIFY_SERVICE_ID"]
|
2022-08-29 19:10:56 -07:00
|
|
|
|
2023-07-14 09:07:23 -07:00
|
|
|
|
2022-08-29 19:10:56 -07:00
|
|
|
def upgrade():
|
2023-07-14 14:59:23 -07:00
|
|
|
conn = op.get_bind()
|
2023-08-29 14:54:30 -07:00
|
|
|
|
2022-08-29 19:10:56 -07:00
|
|
|
# modify name of default service user in services
|
2023-07-14 09:07:23 -07:00
|
|
|
# table_name = 'services'
|
|
|
|
|
# col = 'name'
|
|
|
|
|
# val = 'US Notify'
|
|
|
|
|
# select_by_col = 'id'
|
|
|
|
|
# select_by_val = service_id
|
2023-08-29 14:54:30 -07:00
|
|
|
input_params = {"service_id": service_id}
|
|
|
|
|
conn.execute(
|
|
|
|
|
text("update services set name='US Notify' where id =:service_id"), input_params
|
|
|
|
|
)
|
|
|
|
|
|
2023-07-14 09:07:23 -07:00
|
|
|
# table_name = 'services_history'
|
2023-08-29 14:54:30 -07:00
|
|
|
conn.execute(
|
|
|
|
|
text("update services_history set name='US Notify' where id =:service_id"),
|
|
|
|
|
input_params,
|
|
|
|
|
)
|
|
|
|
|
|
2022-08-29 19:10:56 -07:00
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
|
|
### commands auto generated by Alembic - please adjust! ###
|
|
|
|
|
pass
|
|
|
|
|
### end Alembic commands ###
|