Skip to content

Commit 28c2627

Browse files
authored
fix(knex): Only apply default order for MSSQL (#3145)
1 parent 3eb7428 commit 28c2627

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/knex/src/adapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export class KnexAdapter<
181181
}
182182

183183
// provide default sorting if its not set
184-
if (!filters.$sort) {
184+
if (!filters.$sort && builder.client.driverName === 'mssql') {
185185
builder.orderBy(`${name}.${id}`, 'asc')
186186
}
187187

@@ -238,7 +238,7 @@ export class KnexAdapter<
238238
return Promise.all(data.map((current) => this._create(current, params)))
239239
}
240240

241-
const client = this.db(params).client.config.client
241+
const { client } = this.db(params).client.config
242242
const returning = RETURNING_CLIENTS.includes(client as string) ? [this.id] : []
243243
const rows: any = await this.db(params).insert(data, returning).catch(errorHandler)
244244
const id = data[this.id] || rows[0][this.id] || rows[0]

0 commit comments

Comments
 (0)