eschutho commented on code in PR #29649:
URL: https://github.com/apache/superset/pull/29649#discussion_r1685112856


##########
superset/migrations/versions/2024-07-19_16-11_df3d7e2eb9a4_remove__customer_location_uc.py:
##########
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+Remove _customer_location_uc
+
+Revision ID: df3d7e2eb9a4
+Revises: 02f4f7811799
+Create Date: 2024-07-19 16:11:26.740368
+"""
+
+import logging
+
+from alembic import op
+from migration_utils import create_unique_constraint, drop_unique_constraint
+
+# revision identifiers, used by Alembic.
+revision = "df3d7e2eb9a4"
+down_revision = "02f4f7811799"
+
+logger = logging.getLogger(__name__)
+
+
+def upgrade():
+    try:
+        drop_unique_constraint(op, "_customer_location_uc", "tables")
+    except Exception:  # pylint: disable=broad-except
+        # Unfortunately the DB migration that creates this constraint has a
+        # try/except block, so that we can't know for sure if the constraint 
exists.

Review Comment:
   Should we raise again if it fails so that it rolls back? What are the 
implications here if there is an error and we can't roll back the transaction 
because we are not raising again? Can you use `generic_find_uq_constraint_name` 
to see if the constraint exists? 



-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to