fix migration edge case#18
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2bdd2e99ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,3 +1,4 @@ | |||
| DROP INDEX `event_winner_event_id_room_index_user_id_unique`;--> statement-breakpoint | |||
| DELETE FROM `event_winner` WHERE `id` NOT IN (SELECT MIN(`id`) FROM `event_winner` GROUP BY `event_id`, `user_id`);--> statement-breakpoint | |||
There was a problem hiding this comment.
Preserve distinct winner roles when deduping rows
When an existing event has the same user declared in multiple rooms under different role_id values (possible if the event's winner role was changed between room declarations), this deletes all but the lowest-id row for that user. clearEventWinners later revokes only the roleId values still present in event_winner (see src/utils/winner.utils.ts lines 64-70), so the discarded role grants have no remaining cleanup record and can be left on the member after the next clear/open cycle. Consider detecting conflicting role_ids before deduping or otherwise preserving/removing those extra role grants instead of silently dropping the rows.
Useful? React with 👍 / 👎.
No description provided.