Add comment reminder to add template redacted when creating a template

through a migration.
Also fix the downgrades so they delete everything that needs deleting.
This commit is contained in:
Pea Tyczynska
2019-06-26 18:33:24 +01:00
parent bd3594b2a9
commit 9782b08982
7 changed files with 105 additions and 10 deletions

View File

@@ -8,12 +8,12 @@ Create Date: 2016-10-11 09:24:45.669018
# revision identifiers, used by Alembic.
from datetime import datetime
from alembic import op
revision = '0057_change_email_template'
down_revision = '0056_minor_updates'
from alembic import op
user_id= '6af522d0-2915-4e52-83a3-3690455a5fe6'
user_id = '6af522d0-2915-4e52-83a3-3690455a5fe6'
service_id = 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553'
template_id = 'eb4d9930-87ab-4aef-9bce-786762687884'
@@ -49,7 +49,19 @@ def upgrade():
service_id,
template_name, user_id))
# 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():
op.execute("delete from templates_history where id = '{}'".format(template_id))
op.execute("delete from templates where id = '{}'".format(template_id))
op.execute("DELETE FROM notifications WHERE template_id = '{}'".format(template_id))
op.execute("DELETE FROM notification_history WHERE template_id = '{}'".format(template_id))
op.execute("delete from templates_history where id = '{}'".format(template_id))
op.execute("delete from templates where id = '{}'".format(template_id))