mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-02 01:12:16 +00:00
fix(db): sort the Postgres move's names with an explicit code-unit compare
Five sorts in the Postgres bootstrap and the move from SQLite relied on the default sort, which SonarCloud reports as a bug because it compares by code unit implicitly. They order migration names, table names and JSON keys for a checksum, where locale-aware ordering would change the result, so each now names the code-unit compare the default already used. Nothing changes.
This commit is contained in:
@@ -332,7 +332,7 @@ export function stableJson(text: string): string {
|
||||
if (value !== null && typeof value === 'object') {
|
||||
return Object.fromEntries(
|
||||
Object.keys(value)
|
||||
.sort()
|
||||
.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))
|
||||
.map((key) => [key, sort((value as Record<string, unknown>)[key])]),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user