code review feedback

This commit is contained in:
Kenneth Kehl
2023-07-14 14:59:23 -07:00
parent e6077c187c
commit 4d090ed9ef
7 changed files with 125 additions and 60 deletions

View File

@@ -9,6 +9,8 @@ Create Date: 2022-08-22 11:04:15.888017
# revision identifiers, used by Alembic.
from datetime import datetime
from sqlalchemy import text
revision = '0374_fix_reg_template_history'
down_revision = '0373_add_notifications_view'
@@ -18,32 +20,27 @@ import sqlalchemy as sa
service_id = 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553'
user_id= '6af522d0-2915-4e52-83a3-3690455a5fe6'
def upgrade():
op.get_bind()
conn = op.get_bind()
# modify subject of verification email in templates
table_name = 'templates'
col = 'subject'
val = 'Confirm US Notify registration'
select_by_col = 'name'
select_by_val = 'Notify email verification code'
op.execute(f"update {table_name} set {col}='{val}' where {select_by_col} = '{select_by_val}'")
conn.execute("update templates set subject='Confirm US Notify registration' "
"where name = 'Notify email verification code'")
# modify subject of verification email in templates_history
table_name = 'templates_history'
op.execute(f"update {table_name} set {col}='{val}' where {select_by_col} = '{select_by_val}'")
conn.execute("update templates_history set subject='Confirm US Notify registration' "
"where name = 'Notify email verification code'")
# modify content of verification email in templates
# table_name = 'templates'
# col = 'content'
val = """Hi ((name)),\n\nTo complete your registration for US Notify please click the link below\n\n((url))"""
# select_by_col = 'name'
# select_by_val = 'Notify email verification code'
op.execute("update templates set content='{}' where name = 'Notify email verification code'".format(val))
input_params = {
"val": val
}
conn.execute(text("update templates set content=:val where name = 'Notify email verification code'"), input_params)
# modify content of verification email in templates_history
# table_name = 'templates_history'
op.execute("update templates_history set content='{}' where name = 'Notify email verification code'".format(val))
conn.execute(text("update templates_history set content=:val where name = 'Notify email verification code'"), input_params)
# TODO: modify other templates as necessary and re-run this migration