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


##########
superset/migrations/shared/catalogs.py:
##########
@@ -505,7 +505,15 @@ def upgrade_schema_perms(
             .filter_by(name=current_perm)
             .one_or_none()
         ):
-            existing_pvm.name = new_perm
+            # check that new_perm does not exist
+            if session.query(ViewMenu).filter_by(name=new_perm).one_or_none():
+                logger.warning(
+                    "New permission %s already exists. Removing old one",
+                    new_perm,
+                )
+                session.delete(existing_pvm)

Review Comment:
   @betodealmeida not sure if you would prefer to return pvms to be deleted 
instead of deleting them here



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