bkyryliuk commented on a change in pull request #11115:
URL: 
https://github.com/apache/incubator-superset/pull/11115#discussion_r497630746



##########
File path: 
superset/migrations/versions/18532d70ab98_fix_table_unique_constraint_in_mysql.py
##########
@@ -27,16 +27,20 @@
 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():
-    pass
+    bind = op.get_bind()
+    if isinstance(bind.dialect, MySQLDialect):
+        # index only exists in mysql db
+        with op.get_context().autocommit_block():
+            op.add_constraint("table_name", "tables", type_="unique")

Review comment:
       AttributeError: module 'alembic.op' has no attribute 'add_constraint'
   
   I would say - let's pass on the downgrade. That constraint was never needed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to