Disable upserting for MSSQL in bulkImport for now.

This commit is contained in:
Sam Rose 2024-06-18 18:02:20 +01:00
parent 5ac8a7d514
commit e288fc8795
No known key found for this signature in database
2 changed files with 71 additions and 63 deletions

View File

@ -588,6 +588,10 @@ class InternalBuilder {
throw new Error("Primary key is required for upsert")
}
return query.insert(parsedBody).onConflict(primary).merge()
} else if (this.client === SqlClient.MS_SQL) {
// No upsert or onConflict support in MSSQL yet, see:
// https://github.com/knex/knex/pull/6050
return query.insert(parsedBody)
}
return query.upsert(parsedBody)
}

View File

@ -65,6 +65,7 @@ describe.each([
[DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)],
])("/rows (%s)", (providerType, dsProvider) => {
const isInternal = dsProvider === undefined
const isMSSQL = providerType === DatabaseName.SQL_SERVER
const config = setup.getConfig()
let table: Table
@ -1013,6 +1014,9 @@ describe.each([
await assertRowUsage(isInternal ? rowUsage + 2 : rowUsage)
})
// Upserting isn't yet supported in MSSQL, see:
// https://github.com/knex/knex/pull/6050
!isMSSQL &&
it("should be able to update existing rows with bulkImport", async () => {
const table = await config.api.table.save(
saveTableRequest({