Skip to content

Commit

Permalink
fix: alembic migration error msg trying to delete constraint on tables (
Browse files Browse the repository at this point in the history
#11115)

* fix: alembic migration fails by deleting non existent constraint on tables

* Revert "fix: alembic migration fails by deleting non existent constraint on tables"

This reverts commit 3a359b0.

* mantain migration but just for MySQL and add downgrade procedure

* skip the downgrade
  • Loading branch information
dpgaspar committed Oct 1, 2020
1 parent fdb26f6 commit 50d8040
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -27,15 +27,15 @@
down_revision = "3fbbc6e8d654"

from alembic import op
from sqlalchemy.dialects.mysql.base import MySQLDialect


def upgrade():
try:
bind = op.get_bind()
if isinstance(bind.dialect, MySQLDialect):
# index only exists in mysql db
with op.get_context().autocommit_block():
op.drop_constraint("table_name", "tables", type_="unique")
except Exception as ex:
print(ex)


def downgrade():
Expand Down

0 comments on commit 50d8040

Please sign in to comment.