Files
notifications-api/migrations/versions/0374_fix_reg_template_history.py

66 lines
1.7 KiB
Python
Raw Normal View History

2022-08-29 19:10:56 -07:00
"""empty message
Revision ID: 0374_fix_reg_template_history
Revises: 0373_add_notifications_view
Create Date: 2022-08-22 11:04:15.888017
"""
# revision identifiers, used by Alembic.
from datetime import datetime
2023-07-14 14:59:23 -07:00
from sqlalchemy import text
2023-08-29 14:54:30 -07:00
revision = "0374_fix_reg_template_history"
down_revision = "0373_add_notifications_view"
2022-08-29 19:10:56 -07:00
import sqlalchemy as sa
from alembic import op
2022-08-29 19:10:56 -07:00
2023-08-29 14:54:30 -07:00
service_id = "d6aa2c68-a2d9-4437-ab19-3ae8eb202553"
user_id = "6af522d0-2915-4e52-83a3-3690455a5fe6"
2022-08-29 19:10:56 -07:00
2023-07-14 14:59: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 subject of verification email in templates
2023-08-29 14:54:30 -07:00
conn.execute(
text(
"UPDATE templates SET subject='Confirm US Notify registration' WHERE name = 'Notify email verification code'"
)
2023-08-29 14:54:30 -07:00
)
2022-08-29 19:10:56 -07:00
# modify subject of verification email in templates_history
2023-08-29 14:54:30 -07:00
conn.execute(
text(
"UPDATE templates_history SET subject='Confirm US Notify registration' WHERE name = 'Notify email verification code'"
)
2023-08-29 14:54:30 -07:00
)
2022-08-29 19:10:56 -07:00
val = """Hi ((name)),\n\nTo complete your registration for US Notify please click the link below\n\n((url))"""
2023-08-29 14:54:30 -07:00
input_params = {"val": val}
conn.execute(
text(
"update templates set content=:val where name = 'Notify email verification code'"
),
input_params,
)
2022-08-29 19:10:56 -07:00
# modify content of verification email in templates_history
# table_name = 'templates_history'
2023-08-29 14:54:30 -07:00
conn.execute(
text(
"update templates_history set content=:val where name = 'Notify email verification code'"
),
input_params,
)
2022-08-29 19:10:56 -07:00
# TODO: modify other templates as necessary and re-run this migration
2023-08-29 14:54:30 -07:00
2022-08-29 19:10:56 -07:00
def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###