@mikro-orm/sql 7.1.15-dev.13 → 7.1.15-dev.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AbstractSqlDriver.js
CHANGED
|
@@ -915,7 +915,8 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
915
915
|
if (!options.upsert && options.unionWhere?.length) {
|
|
916
916
|
where = (await this.applyUnionWhere(meta, where, options, true));
|
|
917
917
|
}
|
|
918
|
-
|
|
918
|
+
// a TPT table declaring the version property is bumped even when only other tables of the hierarchy changed
|
|
919
|
+
if (Utils.hasObjectKeys(data) || (meta.inheritanceType === 'tpt' && meta.ownsVersionProperty())) {
|
|
919
920
|
const qb = this.createQueryBuilder(entityName, options.ctx, 'write', options.convertCustomTypes, options.loggerContext).withSchema(this.getSchemaName(meta, options));
|
|
920
921
|
qb.setAbortOptions(pickAbortOptions(options));
|
|
921
922
|
if (options.upsert) {
|
|
@@ -941,7 +942,7 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
941
942
|
qb.update(data).where(where);
|
|
942
943
|
// reload generated columns and version fields
|
|
943
944
|
const returning = [];
|
|
944
|
-
meta
|
|
945
|
+
this.getTableProps(meta)
|
|
945
946
|
.filter(prop => (prop.generated && !prop.primary) || prop.version)
|
|
946
947
|
.forEach(prop => returning.push(prop.name));
|
|
947
948
|
qb.returning(returning);
|
|
@@ -992,7 +993,10 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
992
993
|
}
|
|
993
994
|
}
|
|
994
995
|
// reload generated columns and version fields
|
|
995
|
-
meta.
|
|
996
|
+
meta.getPrimaryProps().forEach(prop => returning.add(prop.name));
|
|
997
|
+
this.getTableProps(meta)
|
|
998
|
+
.filter(prop => prop.generated || prop.version)
|
|
999
|
+
.forEach(prop => returning.add(prop.name));
|
|
996
1000
|
const pkCond = Utils.flatten(meta.primaryKeys.map(pk => meta.properties[pk].fieldNames))
|
|
997
1001
|
.map(pk => `${this.platform.quoteIdentifier(pk)} = ?`)
|
|
998
1002
|
.join(' and ');
|
|
@@ -1050,7 +1054,7 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
1050
1054
|
return sql;
|
|
1051
1055
|
});
|
|
1052
1056
|
}
|
|
1053
|
-
if (meta.
|
|
1057
|
+
if (meta.ownsVersionProperty()) {
|
|
1054
1058
|
const versionProperty = meta.properties[meta.versionProperty];
|
|
1055
1059
|
const quotedFieldName = this.platform.quoteIdentifier(versionProperty.fieldNames[0]);
|
|
1056
1060
|
sql += `${quotedFieldName} = `;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.1.15-dev.
|
|
3
|
+
"version": "7.1.15-dev.14",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@mikro-orm/core": "^7.1.14"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.1.15-dev.
|
|
56
|
+
"@mikro-orm/core": "7.1.15-dev.14"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|
|
@@ -763,7 +763,7 @@ export class QueryBuilderHelper {
|
|
|
763
763
|
}
|
|
764
764
|
updateVersionProperty(qb, data) {
|
|
765
765
|
const meta = this.#metadata.find(this.#entityName);
|
|
766
|
-
if (!meta?.
|
|
766
|
+
if (!meta?.ownsVersionProperty() || meta.versionProperty in data) {
|
|
767
767
|
return;
|
|
768
768
|
}
|
|
769
769
|
const versionProperty = meta.properties[meta.versionProperty];
|