Files
notifications-api/migrations/versions/0130_service_email_reply_to_row.py

54 lines
1.2 KiB
Python
Raw Normal View History

2017-10-27 14:34:55 +01:00
"""empty message
Revision ID: 0130_service_email_reply_to_row
Revises: 0129_add_email_auth_permission
Create Date: 2017-08-29 14:09:41.042061
"""
# revision identifiers, used by Alembic.
2023-07-17 11:29:08 -07:00
from sqlalchemy import text
2023-08-29 14:54:30 -07:00
revision = "0130_service_email_reply_to_row"
down_revision = "0129_add_email_auth_permission"
2017-10-27 14:34:55 +01:00
from alembic import op
2023-08-29 14:54:30 -07:00
NOTIFY_SERVICE_ID = "d6aa2c68-a2d9-4437-ab19-3ae8eb202553"
EMAIL_REPLY_TO_ID = "b3a58d57-2337-662a-4cba-40792a9322f2"
2017-10-27 14:34:55 +01:00
def upgrade():
2023-07-17 11:29:08 -07:00
conn = op.get_bind()
input_params = {
"email_reply_to": EMAIL_REPLY_TO_ID,
2023-08-29 14:54:30 -07:00
"notify_service_id": NOTIFY_SERVICE_ID,
2023-07-17 11:29:08 -07:00
}
2023-08-29 14:54:30 -07:00
conn.execute(
text(
"""
2017-10-27 14:34:55 +01:00
INSERT INTO service_email_reply_to
(id, service_id, email_address, is_default, created_at)
VALUES
2023-07-17 11:29:08 -07:00
(:email_reply_to, :notify_service_id, 'testsender@dispostable.com', 'f', NOW())
2023-08-29 14:54:30 -07:00
"""
),
input_params,
)
2017-10-27 14:34:55 +01:00
def downgrade():
2023-07-17 11:29:08 -07:00
conn = op.get_bind()
input_params = {
"email_reply_to": EMAIL_REPLY_TO_ID,
}
2023-08-29 14:54:30 -07:00
conn.execute(
text(
"""
2017-10-27 14:34:55 +01:00
DELETE FROM service_email_reply_to
2023-07-17 11:29:08 -07:00
WHERE id = :email_reply_to
2023-08-29 14:54:30 -07:00
"""
),
input_params,
)