Skip to content

fix(db): make composite unique constraints unique indexes - #453

Merged
aamoghS merged 2 commits into
devfrom
fix/event-check-in-index
Oct 1, 2026
Merged

aamoghS merged 2 commits into
devfrom
fix/event-check-in-index

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Automated PR tracking changes from fix/event-check-in-index into dev.


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 named uniqueIndex() definitions across bootcamp, events, hackathons, initiatives, and judge schemas so drizzle-kit push stops 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, and event_attendee_event_participant_idx. registration.ts duplicate detection and internal test mocks that simulate 23505 errors are updated to match those new names. admin.ts only 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.

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.
@github-actions github-actions Bot added the bug Something isn't working label Oct 1, 2026
@aamoghS aamoghS changed the title Feature: fix/event-check-in-index to dev fix(db): make composite unique constraints unique indexes Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
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

@aamoghS
aamoghS merged commit c487f8f into dev Oct 1, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⤵️ pull bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant