Merge pull request !2852 from rhodecode-enterprise-ce fix/user-deletion-repo-groups-null-constraint

User deletion fix
This commit is contained in:
Andrii Verbytskyi 2025-11-03 08:45:23 +00:00
commit 814961065b

View file

@ -609,6 +609,10 @@ class UserModel(BaseModel):
if detach_artifacts:
self._detach_user_artifacts(user.username, user.artifacts, new_owner)
# Flush all detach operations to database before deleting user
# Ensures foreign keys are properly updated and prevents NULL constraint violations
self.sa.flush()
user_data = user.get_dict() # fetch user data before expire
# we might change the user data with detach/delete, make sure