mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
more files
This commit is contained in:
@@ -9,6 +9,8 @@ Create Date: 2016-06-13 11:04:15.888017
|
|||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0028_fix_reg_template_history'
|
revision = '0028_fix_reg_template_history'
|
||||||
down_revision = '0027_update_provider_rates'
|
down_revision = '0027_update_provider_rates'
|
||||||
|
|
||||||
@@ -25,14 +27,24 @@ def upgrade():
|
|||||||
template_history_insert = """INSERT INTO templates_history (id, name, template_type, created_at,
|
template_history_insert = """INSERT INTO templates_history (id, name, template_type, created_at,
|
||||||
content, archived, service_id,
|
content, archived, service_id,
|
||||||
subject, created_by_id, version)
|
subject, created_by_id, version)
|
||||||
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', 1)
|
VALUES (:id, :name, :type, :time_now, :content, False, :service_id, :subject, :user_id, 1)
|
||||||
"""
|
"""
|
||||||
email_verification_content = \
|
email_verification_content = \
|
||||||
"""Hi ((name)),\n\nTo complete your registration for GOV.UK Notify please click the link below\n\n((url))"""
|
"""Hi ((name)),\n\nTo complete your registration for GOV.UK Notify please click the link below\n\n((url))"""
|
||||||
op.execute(template_history_insert.format('ece42649-22a8-4d06-b87f-d52d5d3f0a27',
|
|
||||||
'Notify email verification code', 'email',
|
input_params = {
|
||||||
datetime.utcnow(), email_verification_content, service_id,
|
"id": 'ece42649-22a8-4d06-b87f-d52d5d3f0a27',
|
||||||
'Confirm GOV.UK Notify registration', user_id))
|
"name": 'Notify email verification code',
|
||||||
|
"type": "email",
|
||||||
|
"time_now": datetime.utcnow(),
|
||||||
|
"content": email_verification_content,
|
||||||
|
"service_id": service_id,
|
||||||
|
"subject": 'Confirm GOV.UK Notify registration',
|
||||||
|
"user_id": user_id
|
||||||
|
}
|
||||||
|
conn = op.get_bind()
|
||||||
|
conn.execute(text(template_history_insert), input_params)
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ Create Date: 2016-07-07 16:02:06.241769
|
|||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0041_email_template'
|
revision = '0041_email_template'
|
||||||
down_revision = '0040_adjust_mmg_provider_rate'
|
down_revision = '0040_adjust_mmg_provider_rate'
|
||||||
|
|
||||||
@@ -22,11 +24,13 @@ def upgrade():
|
|||||||
template_history_insert = """INSERT INTO templates_history (id, name, template_type, created_at,
|
template_history_insert = """INSERT INTO templates_history (id, name, template_type, created_at,
|
||||||
content, archived, service_id,
|
content, archived, service_id,
|
||||||
subject, created_by_id, version)
|
subject, created_by_id, version)
|
||||||
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', 1)
|
VALUES (:template_id, :template_name, :template_type, :time_now,
|
||||||
|
:content, False, :service_id, :subject, :user_id, 1)
|
||||||
"""
|
"""
|
||||||
template_insert = """INSERT INTO templates (id, name, template_type, created_at,
|
template_insert = """INSERT INTO templates (id, name, template_type, created_at,
|
||||||
content, archived, service_id, subject, created_by_id, version)
|
content, archived, service_id, subject, created_by_id, version)
|
||||||
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', 1)
|
VALUES (:template_id, :template_name, :template_type, :time_now,
|
||||||
|
:content, False, :service_id, :subject, :user_id, 1)
|
||||||
"""
|
"""
|
||||||
content = """You already have a GOV.UK Notify account with this email address.
|
content = """You already have a GOV.UK Notify account with this email address.
|
||||||
|
|
||||||
@@ -37,25 +41,20 @@ If you’ve forgotten your password, you can reset it here: ((forgot_password_ur
|
|||||||
|
|
||||||
If you didn’t try to register for a GOV.UK Notify account recently, please let us know here: ((feedback_url))"""
|
If you didn’t try to register for a GOV.UK Notify account recently, please let us know here: ((feedback_url))"""
|
||||||
|
|
||||||
op.get_bind()
|
input_params = {
|
||||||
op.execute(template_history_insert.format('0880fbb1-a0c6-46f0-9a8e-36c986381ceb',
|
"template_id": '0880fbb1-a0c6-46f0-9a8e-36c986381ceb',
|
||||||
'Your GOV.UK Notify account', 'email',
|
"template_name": 'Your GOV.UK Notify account',
|
||||||
datetime.utcnow(), content, service_id,
|
"template_type": 'email',
|
||||||
'Your GOV.UK Notify account', user_id))
|
"time_now": datetime.utcnow(),
|
||||||
op.execute(
|
"content": content,
|
||||||
template_insert.format('0880fbb1-a0c6-46f0-9a8e-36c986381ceb', 'Your GOV.UK Notify account', 'email',
|
"service_id": service_id,
|
||||||
datetime.utcnow(), content, service_id,
|
"subject": 'Your GOV.UK Notify account',
|
||||||
'Your GOV.UK Notify account', user_id))
|
"user_id": user_id
|
||||||
|
}
|
||||||
|
conn = op.get_bind()
|
||||||
|
|
||||||
# If you are copying this migration, please remember about an insert to TemplateRedacted,
|
conn.execute(text(template_history_insert), input_params)
|
||||||
# which was not originally included here either by mistake or because it was before TemplateRedacted existed
|
conn.execute(text(template_insert), input_params)
|
||||||
# op.execute(
|
|
||||||
# """
|
|
||||||
# INSERT INTO template_redacted (template_id, redact_personalisation, updated_at, updated_by_id)
|
|
||||||
# VALUES ('0880fbb1-a0c6-46f0-9a8e-36c986381ceb', '{}', '{}', '{}')
|
|
||||||
# ;
|
|
||||||
# """.format(False, datetime.utcnow(), user_id)
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ Create Date: 2016-10-11 09:24:45.669018
|
|||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
revision = '0057_change_email_template'
|
revision = '0057_change_email_template'
|
||||||
down_revision = '0056_minor_updates'
|
down_revision = '0056_minor_updates'
|
||||||
@@ -22,11 +23,13 @@ def upgrade():
|
|||||||
template_history_insert = """INSERT INTO templates_history (id, name, template_type, created_at,
|
template_history_insert = """INSERT INTO templates_history (id, name, template_type, created_at,
|
||||||
content, archived, service_id,
|
content, archived, service_id,
|
||||||
subject, created_by_id, version)
|
subject, created_by_id, version)
|
||||||
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', 1)
|
VALUES (:template_id, :template_name, :template_type, :time_now, :content, False,
|
||||||
|
:service_id, :subject, :user_id, 1)
|
||||||
"""
|
"""
|
||||||
template_insert = """INSERT INTO templates (id, name, template_type, created_at,
|
template_insert = """INSERT INTO templates (id, name, template_type, created_at,
|
||||||
content, archived, service_id, subject, created_by_id, version)
|
content, archived, service_id, subject, created_by_id, version)
|
||||||
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', 1)
|
VALUES (:template_id, :template_name, :template_type, :time_now, :content, False,
|
||||||
|
:service_id, :subject, :user_id, 1)
|
||||||
"""
|
"""
|
||||||
template_content = \
|
template_content = \
|
||||||
"""Hi ((name)),\n\nClick this link to confirm your new email address:
|
"""Hi ((name)),\n\nClick this link to confirm your new email address:
|
||||||
@@ -35,33 +38,27 @@ def upgrade():
|
|||||||
\n\n((feedback_url))"""
|
\n\n((feedback_url))"""
|
||||||
|
|
||||||
template_name = 'Confirm new email address'
|
template_name = 'Confirm new email address'
|
||||||
op.execute(template_history_insert.format(template_id,
|
input_params = {
|
||||||
template_name,
|
"template_id": template_id,
|
||||||
'email',
|
"template_name": template_name,
|
||||||
datetime.utcnow(), template_content,
|
"template_type": 'email',
|
||||||
service_id,
|
"time_now": datetime.utcnow(),
|
||||||
template_name, user_id))
|
"content": template_content,
|
||||||
op.execute(template_insert.format(template_id,
|
"service_id": service_id,
|
||||||
template_name,
|
"subject": template_name,
|
||||||
'email',
|
"user_id": user_id
|
||||||
datetime.utcnow(),
|
}
|
||||||
template_content,
|
conn = op.get_bind()
|
||||||
service_id,
|
conn.execute(text(template_history_insert), input_params)
|
||||||
template_name, user_id))
|
conn.execute(text(template_insert), input_params)
|
||||||
|
|
||||||
# If you are copying this migration, please remember about an insert to TemplateRedacted,
|
|
||||||
# which was not originally included here either by mistake or because it was before TemplateRedacted existed
|
|
||||||
# op.execute(
|
|
||||||
# """
|
|
||||||
# INSERT INTO template_redacted (template_id, redact_personalisation, updated_at, updated_by_id)
|
|
||||||
# VALUES ('{}', '{}', '{}', '{}')
|
|
||||||
# ;
|
|
||||||
# """.format(template_id, False, datetime.utcnow(), user_id)
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
op.execute("DELETE FROM notifications WHERE template_id = '{}'".format(template_id))
|
input_params = {
|
||||||
op.execute("DELETE FROM notification_history WHERE template_id = '{}'".format(template_id))
|
"template_id": template_id
|
||||||
op.execute("delete from templates_history where id = '{}'".format(template_id))
|
}
|
||||||
op.execute("delete from templates where id = '{}'".format(template_id))
|
conn = op.get_bind()
|
||||||
|
conn.execute(text("DELETE FROM notifications WHERE template_id = :template_id"), input_params)
|
||||||
|
conn.execute(text("DELETE FROM notification_history WHERE template_id = :template_id"), input_params)
|
||||||
|
conn.execute(text("delete from templates_history where id = :template_id"), input_params)
|
||||||
|
conn.execute(text("delete from templates where id = :template_id"), input_params)
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
"""
|
|
||||||
|
|
||||||
Revision ID: d2db89558026
|
|
||||||
Revises: 0395_add_total_message_limit
|
|
||||||
Create Date: 2023-04-27 14:59:39.428607
|
|
||||||
|
|
||||||
"""
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
revision = 'd2db89558026'
|
|
||||||
down_revision = '0397_rename_organisation_2'
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
pass
|
|
||||||
Reference in New Issue
Block a user