From df2f6cf257b4a1c9013b8be8683157daed5208e9 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 16 Jan 2025 14:13:48 +0000 Subject: [PATCH] re-added nulls --- packages/backend-core/src/sql/sql.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/backend-core/src/sql/sql.ts b/packages/backend-core/src/sql/sql.ts index eb103d3e2e..04b1309534 100644 --- a/packages/backend-core/src/sql/sql.ts +++ b/packages/backend-core/src/sql/sql.ts @@ -1167,15 +1167,14 @@ class InternalBuilder { let nulls: "first" | "last" | undefined = undefined if ( this.client === SqlClient.POSTGRES || - this.client === SqlClient.ORACLE + this.client === SqlClient.ORACLE || + this.client === SqlClient.SQL_LITE ) { nulls = value.direction === SortOrder.ASCENDING ? "first" : "last" } if (this.isAggregateField(key)) { - // query = query.orderBy(this.quotedIdentifier(key), direction, nulls) - // query = query.orderBy(this.rawQuotedIdentifier(key), direction, nulls) - query = query.orderByRaw(`?? ??`, [ + query = query.orderByRaw(`?? ?? nulls ??`, [ this.rawQuotedIdentifier(key), this.knex.raw(direction), this.knex.raw(nulls as string), @@ -1189,11 +1188,11 @@ class InternalBuilder { this.knex.raw(nulls as string), ]) } else { - query = query.orderByRaw(`?? ??`, [ + query = query.orderByRaw(`?? ?? nulls ??`, [ this.rawQuotedIdentifier(composite), this.knex.raw(direction), + this.knex.raw(nulls as string) ]) - // query = query.orderBy(this.quotedIdentifier(key), direction, nulls) } } }