Skip to content

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

Open
jakebromberg wants to merge 2 commits intomainfrom
fix/37-redundant-index
Open

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

Conversation

@jakebromberg
Copy link
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

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 7b24354 to 04dcc81 Compare February 27, 2026 05:56
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.

1 participant