Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unique constraint on reviews by author and targetUserId #1038

Merged
merged 7 commits into from
Dec 11, 2024

Conversation

luiqor
Copy link
Contributor

@luiqor luiqor commented Dec 9, 2024

Issue

Student can have multiple cooperations with the same tutor. Also student is prompted to leave a review by the end of every cooperation.
However, reviewSchema includes an index with unique constraint that disallows user to leave multiple comment to the same tutor

Fix

  • Add migarte-mongo package, migrate-mongo-config.js
  • Add scripts: "npm run migrate", "npm run migrate:rollback"
  • Add migration to remove author_1_targetUserId_1
  • Replace author_1_targetUserId_1 index with author_1_targetUserId_1_offer_1

@luiqor luiqor added the Backend label Dec 9, 2024
@luiqor luiqor self-assigned this Dec 9, 2024
@luiqor luiqor linked an issue Dec 9, 2024 that may be closed by this pull request
3 tasks
@luiqor luiqor force-pushed the bugfix/1022/fix-unique-author-target-user-index branch from a13ab9d to 44b05b4 Compare December 9, 2024 10:04
@luiqor luiqor marked this pull request as ready for review December 10, 2024 07:44
package.json Outdated Show resolved Hide resolved
migrate-mongo-config.js Show resolved Hide resolved
@luiqor luiqor merged commit 5be76e7 into develop Dec 11, 2024
4 checks passed
@luiqor luiqor deleted the bugfix/1022/fix-unique-author-target-user-index branch December 11, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix unique constraint for author + targetUser index for Reviews
4 participants