-
Notifications
You must be signed in to change notification settings - Fork 0
β‘ Bolt: Optimized playlist song fetching with innerJoin #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -140,7 +140,7 @@ export class DatabaseStorage implements IStorage { | |||||
| .from(songs) | ||||||
| .innerJoin(songLikes, eq(songs.id, songLikes.songId)) | ||||||
| .where(eq(songLikes.userId, userId)) | ||||||
| .orderBy(desc(songLikes.createdAt).nullsLast()); | ||||||
| .orderBy(desc(songLikes.createdAt)); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Removing Prompt for AI agents
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing PostgreSQL's π€ Prompt for AI AgentsRemoving In PostgreSQL, The real-world impact is negligible, but if a row is ever inserted with an explicit π€ Prompt for AI Agents |
||||||
| } | ||||||
|
|
||||||
| // === Playlists === | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing
.nullsLast()changes the sorting behavior for liked songs that might have anullcreatedAtvalue. With this change, songs with anullcreation date will appear at the top of the list when sorted in descending order (this is the default for PostgreSQL), which is likely not the desired user experience, as thecreatedAtcolumn in thesongLikestable is nullable.While the PR description mentions this was to fix a type error, altering the query's logic could introduce this unintended behavior. If
.nullsLast()is indeed causing a type error, you could consider using a raw SQL fragment to achieve the correct sorting behavior while avoiding the type issue.