Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve issues on upsert #10588

Merged
merged 4 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/query-builder/InsertQueryBuilder.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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