Skip to content

fix: remove redundant .unique() on anonymous_devices.deviceId#197

Merged
jakebromberg merged 2 commits intomainfrom
fix/37-redundant-index
Apr 1, 2026
Merged

fix: remove redundant .unique() on anonymous_devices.deviceId#197
jakebromberg merged 2 commits intomainfrom
fix/37-redundant-index

Conversation

@jakebromberg
Copy link
Copy Markdown
Member

@jakebromberg jakebromberg commented Feb 21, 2026

Summary

  • The anonymous_devices table had both .unique() on the deviceId column and an explicit uniqueIndex('anonymous_devices_device_id_key') in the table's third argument, creating two redundant unique indexes on device_id.
  • Removed the inline .unique() and kept the explicit uniqueIndex for naming control.
  • Added a schema assertion test that verifies exactly one uniqueness constraint exists on device_id.

Test plan

  • New unit test tests/unit/database/schema.anonymous-devices.test.ts fails before fix (count = 2) and passes after (count = 1)
  • Existing unit tests pass (npm run test:unit)
  • No migration generated — this is a schema-definition-only change; the database already has the named index

Made with Cursor

Note: This fix is consolidated in #199 (coordinated schema migration batch). Consider closing in favor of #199.

jakebromberg and others added 2 commits March 31, 2026 20:09
The column had both .unique() and an explicit uniqueIndex, creating
two identical indexes. Kept the explicit uniqueIndex for naming control.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jakebromberg jakebromberg force-pushed the fix/37-redundant-index branch from 19373eb to a83f026 Compare April 1, 2026 03:10
@jakebromberg jakebromberg merged commit 5d42b25 into main Apr 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants