Disable upserting for MSSQL in bulkImport for now.
This commit is contained in:
parent
5ac8a7d514
commit
e288fc8795
2 changed files with 71 additions and 63 deletions
|
@ -588,6 +588,10 @@ class InternalBuilder {
|
||||||
throw new Error("Primary key is required for upsert")
|
throw new Error("Primary key is required for upsert")
|
||||||
}
|
}
|
||||||
return query.insert(parsedBody).onConflict(primary).merge()
|
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)
|
return query.upsert(parsedBody)
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ describe.each([
|
||||||
[DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)],
|
[DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)],
|
||||||
])("/rows (%s)", (providerType, dsProvider) => {
|
])("/rows (%s)", (providerType, dsProvider) => {
|
||||||
const isInternal = dsProvider === undefined
|
const isInternal = dsProvider === undefined
|
||||||
|
const isMSSQL = providerType === DatabaseName.SQL_SERVER
|
||||||
const config = setup.getConfig()
|
const config = setup.getConfig()
|
||||||
|
|
||||||
let table: Table
|
let table: Table
|
||||||
|
@ -1013,6 +1014,9 @@ describe.each([
|
||||||
await assertRowUsage(isInternal ? rowUsage + 2 : rowUsage)
|
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 () => {
|
it("should be able to update existing rows with bulkImport", async () => {
|
||||||
const table = await config.api.table.save(
|
const table = await config.api.table.save(
|
||||||
saveTableRequest({
|
saveTableRequest({
|
||||||
|
|
Loading…
Reference in a new issue