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

57 lines
1.8 KiB
Python
Raw Normal View History

"""empty message
Revision ID: 0028_fix_reg_template_history
2023-07-19 09:19:40 -07:00
Revises: 0026_rename_notify_service
Create Date: 2016-06-13 11:04:15.888017
"""
# revision identifiers, used by Alembic.
from datetime import datetime
2023-07-18 10:27:47 -07:00
from sqlalchemy import text
from app.utils import utc_now
2023-08-29 14:54:30 -07:00
revision = "0028_fix_reg_template_history"
down_revision = "0026_rename_notify_service"
import sqlalchemy as sa
from alembic import op
2023-08-29 14:54:30 -07:00
service_id = "d6aa2c68-a2d9-4437-ab19-3ae8eb202553"
user_id = "6af522d0-2915-4e52-83a3-3690455a5fe6"
def upgrade():
op.get_bind()
2023-08-29 14:54:30 -07:00
op.execute(
"delete from templates_history where name = 'Notify email verification code'"
)
template_history_insert = """INSERT INTO templates_history (id, name, template_type, created_at,
content, archived, service_id,
subject, created_by_id, version)
2023-07-18 10:27:47 -07:00
VALUES (:id, :name, :type, :time_now, :content, False, :service_id, :subject, :user_id, 1)
"""
2023-08-29 14:54:30 -07:00
email_verification_content = """Hi ((name)),\n\nTo complete your registration for GOV.UK Notify please click the link below\n\n((url))"""
2023-07-18 10:27:47 -07:00
input_params = {
2023-08-29 14:54:30 -07:00
"id": "ece42649-22a8-4d06-b87f-d52d5d3f0a27",
"name": "Notify email verification code",
2023-07-18 10:27:47 -07:00
"type": "email",
"time_now": utc_now(),
2023-07-18 10:27:47 -07:00
"content": email_verification_content,
"service_id": service_id,
2023-08-29 14:54:30 -07:00
"subject": "Confirm GOV.UK Notify registration",
"user_id": user_id,
2023-07-18 10:27:47 -07:00
}
conn = op.get_bind()
conn.execute(text(template_history_insert), input_params)
def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###