-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
feat(mysql): support order by nulls first/last
#5021
feat(mysql): support order by nulls first/last
#5021
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5021 +/- ##
=======================================
Coverage 99.66% 99.66%
=======================================
Files 221 221
Lines 16212 16252 +40
Branches 3894 3907 +13
=======================================
+ Hits 16158 16198 +40
Misses 54 54 ☔ View full report in Codecov by Sentry. |
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.
can you check how sqlite behaves? we might need the same there
This uses syntax that is recognized by both SQLite and PostGreSQL
edit: i should read the whole thing first :]
Co-authored-by: Martin Adámek <banan23@gmail.com>
It probably would make sense to create test suites for each language. Currently the QueryBuilder.test.ts file is only testing against MySQL from what I could see. |
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.
just two nits, please apply those suggestions to both drivers
otherwise ready to merge, thanks!
It probably would make sense to create test suites for each language. Currently the QueryBuilder.test.ts file is only testing against MySQL from what I could see.
part of that file is also about postgres, but agreed this would deserve a split and other drivers, probably not a complete copy of what we have there but at least for the differences
@@ -74,4 +74,22 @@ export class MariaDbPlatform extends AbstractSqlPlatform { | |||
return `alter table ${quotedTableName} add fulltext index ${quotedIndexName}(${quotedColumnNames.join(',')})`; | |||
} | |||
|
|||
private readonly NULLS_TRANSLATE = { |
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.
maybe lets remove those to ORDER_BY_NULLS_TRANSLATE
?
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.
Sorry, did you mean rename (not remove)?
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.
yes
Co-authored-by: Martin Adámek <banan23@gmail.com>
order by nulls first/last
Fixes #5004
getOrderByExpression
to AbstractSqlPlatform.ts as an overridable method to formatorderBy
queries. This uses syntax that is recognized by both SQLite and PostGreSQLgetOrderByExpression
to MariaDbPlatform.ts and MySqlPlatform.ts that adds functionality to handle(ASC|DESC) NULLS (FIRST|LAST)
syntax