mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-29 14:01:50 -05:00
Change the order of delete statements to respect foreign key constraint
This commit is contained in:
@@ -79,6 +79,6 @@ def upgrade():
|
||||
def downgrade():
|
||||
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 template_redacted 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))
|
||||
op.execute("DELETE FROM template_redacted WHERE template_id = '{}'".format(template_id))
|
||||
|
||||
@@ -89,7 +89,7 @@ def upgrade():
|
||||
def downgrade():
|
||||
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 template_redacted 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))
|
||||
op.execute("DELETE FROM template_redacted WHERE template_id = '{}'".format(template_id))
|
||||
op.create_unique_constraint('organisation_to_service_service_id_organisation_id_key', 'organisation_to_service', ['service_id', 'organisation_id'])
|
||||
|
||||
@@ -130,12 +130,12 @@ def upgrade():
|
||||
def downgrade():
|
||||
op.execute("DELETE FROM notifications WHERE template_id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM notification_history WHERE template_id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM template_redacted WHERE template_id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM templates_history WHERE id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM templates WHERE id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM template_redacted WHERE template_id = '{}'".format(email_template_id))
|
||||
|
||||
op.execute("DELETE FROM notifications WHERE template_id = '{}'".format(mobile_template_id))
|
||||
op.execute("DELETE FROM notification_history WHERE template_id = '{}'".format(mobile_template_id))
|
||||
op.execute("DELETE FROM template_redacted WHERE template_id = '{}'".format(mobile_template_id))
|
||||
op.execute("DELETE FROM templates_history WHERE id = '{}'".format(mobile_template_id))
|
||||
op.execute("DELETE FROM templates WHERE id = '{}'".format(mobile_template_id))
|
||||
op.execute("DELETE FROM template_redacted WHERE template_id = '{}'".format(mobile_template_id))
|
||||
|
||||
@@ -90,6 +90,6 @@ def upgrade():
|
||||
def downgrade():
|
||||
op.execute("DELETE FROM notifications WHERE template_id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM notification_history WHERE template_id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM templates WHERE id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM templates_history WHERE id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM template_redacted WHERE template_id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM templates_history WHERE id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM templates WHERE id = '{}'".format(email_template_id))
|
||||
|
||||
Reference in New Issue
Block a user