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


##########
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:
   Do we really need to delete anything here? Should we just rename the 
existing ones and create new ones for new catalogs? The old ones are attached 
to roles already and we probably want to maintain those associations.



-- 
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: [email protected]

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