remove any broadcast templates in downgrade step

This commit is contained in:
Leo Hemsted
2020-07-06 16:52:04 +01:00
parent 0282a76bf7
commit 3486355354

View File

@@ -85,6 +85,11 @@ def upgrade():
def downgrade():
op.execute("DELETE FROM template_folder_map WHERE template_id IN (SELECT id FROM templates WHERE template_type = 'broadcast')")
op.execute("DELETE FROM template_redacted WHERE template_id IN (SELECT id FROM templates WHERE template_type = 'broadcast')")
op.execute("DELETE FROM templates WHERE template_type = 'broadcast'")
op.execute("DELETE FROM templates_history WHERE template_type = 'broadcast'")
op.execute(f'ALTER TYPE {name} RENAME TO {tmp_name}')
old_type.create(op.get_bind())