Fix migration misordering

This commit is contained in:
rubenwardy 2020-07-12 02:45:19 +01:00
parent 4bd9411d87
commit e6a7df6144

@ -17,14 +17,14 @@ depends_on = None
def upgrade(): def upgrade():
op.create_check_constraint("mp_name_valid", "meta_package", "name ~* '^[a-z0-9_]+$'")
op.execute(""" op.execute("""
DELETE FROM provides AS t USING meta_package AS m WHERE t.metapackage_id = m.id AND NOT (m.name ~* '^[a-z0-9_]+$'); DELETE FROM provides AS t USING meta_package AS m WHERE t.metapackage_id = m.id AND NOT (m.name ~* '^[a-z0-9_]+$');
DELETE FROM dependency AS t USING meta_package AS m WHERE t.meta_package_id = m.id AND NOT (m.name ~* '^[a-z0-9_]+$'); DELETE FROM dependency AS t USING meta_package AS m WHERE t.meta_package_id = m.id AND NOT (m.name ~* '^[a-z0-9_]+$');
DELETE FROM meta_package WHERE NOT (name ~* '^[a-z0-9_]+$'); DELETE FROM meta_package WHERE NOT (name ~* '^[a-z0-9_]+$');
""") """)
op.create_check_constraint("mp_name_valid", "meta_package", "name ~* '^[a-z0-9_]+$'")
def downgrade(): def downgrade():
op.drop_constraint("mp_name_valid", "meta_package", type_="check") op.drop_constraint("mp_name_valid", "meta_package", type_="check")