Skip to content

fix: add NOT NULL constraints to artist_library_crossreference FK columns#194

Open
jakebromberg wants to merge 3 commits intomainfrom
fix/20-crossref-notnull
Open

fix: add NOT NULL constraints to artist_library_crossreference FK columns#194
jakebromberg wants to merge 3 commits intomainfrom
fix/20-crossref-notnull

Conversation

@jakebromberg
Copy link
Member

@jakebromberg jakebromberg commented Feb 21, 2026

Summary

  • Adds .notNull() to both artist_id and library_id FK columns in the artist_library_crossreference junction table, matching the pattern used by genre_artist_crossreference.
  • A junction table row without both references is meaningless, and nullable columns defeat the existing unique index since NULL != NULL in SQL.
  • Adds a schema assertion test verifying both columns include .notNull().

Test plan

  • New unit test tests/unit/database/schema.crossref.test.ts confirms both FK columns have .notNull()
  • Test fails before the fix, passes after
  • No migration generated — constraint is schema-definition-only (existing data has no NULLs in these columns)

Made with Cursor

All create endpoints (flowsheet entries, bin entries, albums, artists,
rotation, formats, genres, schedule) returned 200 instead of 201.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jakebromberg jakebromberg force-pushed the fix/20-crossref-notnull branch from 0230c92 to 4d0d0c2 Compare February 27, 2026 05:56
@jakebromberg jakebromberg force-pushed the fix/20-crossref-notnull branch from fbd8f53 to ed77db3 Compare February 27, 2026 22:26
The 201 status code changes from commit 46f729f were accidentally
introduced during a rebase and do not belong in this PR, which is
about adding NOT NULL constraints to artist_library_crossreference
FK columns. Reverts all controllers to return 200 for create endpoints
and removes the associated unit test.
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