Conversation
What was broken QA still saw the Prisma unique-conflict error when assigning a private engagement to a member whose previous assignment on the same engagement had been completed. Root cause The service planner and previous named-index migration covered the expected code path, but QA databases can still retain a broad engagement/member assignment unique constraint or index under a different generated name. That stale uniqueness rejects the valid new assignment history row before the service can return the updated engagement. What was changed Added a follow-up migration that discovers and drops any unique constraint or unique index on the exact EngagementAssignment engagementId/memberId pair, regardless of name. The migration then restores the non-unique engagement/member lookup index and recreates the intended active-only unique index for SELECTED and ASSIGNED assignments. Any added/updated tests No new tests were added because existing engagement service coverage already exercises same-member reassignment after COMPLETED and TERMINATED assignments. Validation was run with lint, build, and the full Jest suite.
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.
What was broken
QA still saw the Prisma unique-conflict error when assigning a private engagement to a member whose previous assignment on the same engagement had been completed.
Root cause
The service planner and previous named-index migration covered the expected code path, but QA databases can still retain a broad engagement/member assignment unique constraint or index under a different generated name.
That stale uniqueness rejects the valid new assignment history row before the service can return the updated engagement.
What was changed
Added a follow-up migration that discovers and drops any unique constraint or unique index on the exact EngagementAssignment engagementId/memberId pair, regardless of name.
The migration then restores the non-unique engagement/member lookup index and recreates the intended active-only unique index for SELECTED and ASSIGNED assignments.
Any added/updated tests
No new tests were added because existing engagement service coverage already exercises same-member reassignment after COMPLETED and TERMINATED assignments.
Validation was run with lint, build, and the full Jest suite:
source ~/.nvm/nvm.sh && nvm use && pnpm lintsource ~/.nvm/nvm.sh && nvm use && pnpm buildsource ~/.nvm/nvm.sh && nvm use && pnpm test