fix: mysql referential integrity error in update_user during retire_forum#38
Merged
Alam-2U merged 1 commit intorelease-ulmofrom Apr 22, 2026
Merged
fix: mysql referential integrity error in update_user during retire_forum#38Alam-2U merged 1 commit intorelease-ulmofrom
Alam-2U merged 1 commit intorelease-ulmofrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes MySQL-specific failures in the retire_forum user retirement flow after the forum backend migration from MongoDB to MySQL, addressing referential integrity and uniqueness constraints.
Changes:
- Adjusts deletion order for
ReadState/LastReadTimecleanup to avoid MySQL FK constraint violations. - Stops updating
auth_user.emailin the MySQL backend duringupdate_user(to avoid MySQL UNIQUE constraint collisions). - Bumps package version to
0.5.1.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
forum/backends/mysql/api.py |
Alters update_user behavior for retirement (read-state cleanup ordering and email handling). |
forum/__init__.py |
Version bump reflecting the fix release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ttak-apphelix
approved these changes
Apr 22, 2026
naincy128
approved these changes
Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
After migrating the forum backend from MongoDB to MySQL, user retirement via the
retire_forumAPI was failing due to MySQL-specific constraints that were not handled correctly in the existing implementation.Issues Identified
Foreign Key Constraint Violation
update_userlogic attempted to deleteReadState(parent) records before deleting associatedLastReadTime(child) records.IntegrityErrorduring user retirement.Duplicate Email Constraint Violation
auth_user.email = ""during user retirement.emailfield has aUNIQUEconstraint, and multiple empty strings violate this constraint.Changes Made
Fixed deletion order to maintain referential integrity
LastReadTime(child records) before deletingReadState(parent records).Removed email update from MySQL backend
auth_user.email = ""during user retirement.Ticket
COSMO2-917