fix(db): make composite unique constraints unique indexes - #453
Merged
Merged
Conversation
Same drizzle-kit bug as event_bootcamp_session_idx: constraint columns are introspected with no ORDER BY. Against prod, unique_judge_per_hackathon and unique_assignment_per_hackathon are dropped and re-added on every push. Both tables are empty today, so push passes; the first deploy after a judge registers would stop at the TTY prompt. unique_event_check_in has 36 rows and would stall the moment its introspected order flips. Unique indexes are introspected by column position. Verified on a restored prod dump: the first push swaps all three, later pushes leave them alone, db:check passes, check-in rows are kept.
Converts the last six multi-column unique constraints (bootcamp workshop, hackathon participant, interest, event attendee, announcement recipient, initiative application) to unique indexes, for the same drizzle-kit introspection bug as the previous commit. hackathon_interest (123 rows) and initiative_application (74 rows) would stall a deploy at the TTY prompt the first time push read their columns out of order. registration.ts matched the old constraint name as a fallback to the 23505 check; it now matches the index name, as do the test mocks. Verified on a restored prod dump: one push swaps all nine with no prompt, later pushes leave them alone, db:check passes, row counts unchanged. api tests: 604 passed.
Contributor
Author
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
Author
|
Visit the preview URL for this PR (updated for commit ca81bec): https://hacklytics2027--pr-453-m3u73t85.web.app (expires Thu, 08 Oct 2026 21:24:50 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: c48ba34db61581e25fe2978355160b5eefe0e83f |
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.
Automated PR tracking changes from
fix/event-check-in-indexintodev.Note
Medium Risk
Schema-level renames require a coordinated DB migration/push; mismatched production index names would break friendly duplicate handling in registration and check-in paths until applied.
Overview
Replaces Drizzle
unique()table constraints with explicitly nameduniqueIndex()definitions across bootcamp, events, hackathons, initiatives, and judge schemas sodrizzle-kit pushstops treating column order as a perpetual diff (and avoids Postgres 63-character name truncation on some FK/constraint pairs).Check-in and registration behavior stays the same at the DB level (one row per user/event, participant, etc.), but identifiers change—for example
event_check_in_event_user_idx,hackathon_participant_hackathon_user_idx, andevent_attendee_event_participant_idx.registration.tsduplicate detection and internal test mocks that simulate23505errors are updated to match those new names.admin.tsonly adjusts a comment referencing the hackathon event attendee guard index.Reviewed by Cursor Bugbot for commit ca81bec. Bugbot is set up for automated code reviews on this repo. Configure here.