Skip to content

Commit

Permalink
fix: resolve issues on upsert (#10588)
Browse files Browse the repository at this point in the history
* fix: resolve issues on upsert

Closes: #10587

* fix: test 10563 multiple foreach

* run format

* removed only
  • Loading branch information
alenap93 committed Jan 2, 2024
1 parent a939654 commit dc1bfed
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
13 changes: 13 additions & 0 deletions src/query-builder/InsertQueryBuilder.ts
Expand Up @@ -556,6 +556,19 @@ export class InsertQueryBuilder<
column.isUpdateDate &&
!overwrite?.includes(
column.databaseName,
) &&
!(
(this.connection.driver.options
.type === "oracle" &&
this.getValueSets().length >
1) ||
DriverUtils.isSQLiteFamily(
this.connection.driver,
) ||
this.connection.driver.options
.type === "sap" ||
this.connection.driver.options
.type === "spanner"
),
)
.map(
Expand Down
29 changes: 13 additions & 16 deletions test/github-issues/10563/issue-10563.ts
Expand Up @@ -16,28 +16,25 @@ describe("github issues > #10653 Default value in child table/entity column deco
entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
logging: true,
})),
)
beforeEach(() => reloadTestingDatabases(dataSources))
after(() => closeTestingConnections(dataSources))

it("should honor distinct default value configured on inherited column of child entity", () =>
Promise.all(
it("should honor distinct default value configured on inherited column of child entity", async () =>
await Promise.all(
dataSources.map(async (dataSource) => {
await Promise.all(
dataSources.map(async (dataSource) => {
const manager = dataSource.manager
let dog: Dog = new Dog()
dog.name = "Fifi"
await manager.save(dog)
let fifi = await manager.findOneBy(Dog, {
name: "Fifi",
})
assert(
fifi instanceof Dog && fifi["type"] == "PET",
`Fifi=${JSON.stringify(fifi)}`,
)
}),
const manager = dataSource.manager
let dog: Dog = new Dog()
dog.name = "Fifi"
await manager.save(dog)
let fifi = await manager.findOneBy(Dog, {
name: "Fifi",
})
assert(
fifi instanceof Dog && fifi["type"] == "PET",
`Fifi=${JSON.stringify(fifi)}`,
)
}),
))
Expand Down

0 comments on commit dc1bfed

Please sign in to comment.