Skip to content

fix: change flowsheet.play_order from serial to integer#192

Open
jakebromberg wants to merge 4 commits intomainfrom
fix/19-play-order-type
Open

fix: change flowsheet.play_order from serial to integer#192
jakebromberg wants to merge 4 commits intomainfrom
fix/19-play-order-type

Conversation

@jakebromberg
Copy link
Member

@jakebromberg jakebromberg commented Feb 21, 2026

Summary

  • Changed flowsheet.play_order column type from serial to integer in the Drizzle schema
  • play_order is manually managed by reorder operations and should not auto-increment; the serial type wasted a PostgreSQL sequence and could collide with manually assigned values
  • Added a schema assertion test (tests/unit/database/schema.flowsheet.test.ts) that guards against regression

Test plan

  • Schema assertion test fails before the fix (confirms serial('play_order') detected)
  • Schema assertion test passes after the fix
  • Verify existing flowsheet reorder operations still work correctly
  • No migration generated — column type change only affects the ORM layer (existing DB column is already integer with a sequence that can be dropped separately)

Fixes #19

Made with Cursor

play_order is manually managed by reorder operations and should not
auto-increment. The serial type wasted a sequence and could collide
with manually assigned values.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jakebromberg jakebromberg force-pushed the fix/19-play-order-type branch from 220a205 to 8133555 Compare February 27, 2026 05:56
Jake Bromberg added 3 commits February 27, 2026 10:46
play_order changed from serial to integer, requiring explicit values.
Add getNextPlayOrder() helper that computes max(play_order)+1 per show.
Use it in addTrack, startShow, endShow, and DJ join/leave notifications.
getNextPlayOrder() was scoped per-show (WHERE show_id = X), making
play_order values non-globally-unique. Queries use ORDER BY play_order
DESC globally, so the sequence must be monotonically increasing across
all shows to preserve correct ordering.
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.

Posting a new flowsheet entry results in a postgres error

1 participant