Repository navigation
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.
fix(db): make composite unique constraints unique indexes
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
devintomain.Note
Medium Risk
Schema-level uniqueness enforcement changes require a successful DB push/migration; misalignment between code and deployed indexes could break duplicate detection until migrated.
Overview
Replaces Drizzle
unique()table constraints with explicitly nameduniqueIndex()definitions across bootcamp, events, hackathons, initiatives, and judge schemas. Index names follow a consistent pattern (e.g.hackathon_participant_hackathon_user_idx,event_check_in_event_user_idx) sodrizzle-kit pushstops treating column order as a perpetual diff and re-creating constraints on every deploy.Registration and scan flows still map Postgres 23505 violations to friendly errors;
registration.tsnow recognizes duplicates viahackathon_participant_hackathon_user_idx, and comments inadmin.tsreferenceevent_attendee_event_participant_idx. Internal edge tests were updated so mocked duplicate-key messages match the new index names.Reviewed by Cursor Bugbot for commit c487f8f. Bugbot is set up for automated code reviews on this repo. Configure here.