@mikro-orm/core
Advanced tools
Comparing version 6.3.14-dev.52 to 6.3.14-dev.53
@@ -18,2 +18,4 @@ import type { ReferenceOptions } from './Property'; | ||
joinColumns?: string[]; | ||
/** When a part of a composite column is shared in other properties, use this option to specify what columns are considered as owned by this property. This is useful when your composite property is nullable, but parts of it are not. */ | ||
ownColumns?: string[]; | ||
/** Override the default database column name on the target entity (see {@doclink naming-strategy | Naming Strategy}). This option is only for simple properties represented by a single column. */ | ||
@@ -20,0 +22,0 @@ referenceColumnName?: string; |
@@ -226,3 +226,3 @@ "use strict"; | ||
delete data[k]; | ||
prop.joinColumns.forEach((joinColumn, idx) => data[joinColumn] = null); | ||
prop.ownColumns.forEach(joinColumn => data[joinColumn] = null); | ||
return; | ||
@@ -229,0 +229,0 @@ } |
@@ -34,2 +34,3 @@ import { type Constructor, EntityMetadata } from '../typings'; | ||
private applyNamingStrategy; | ||
private initOwnColumns; | ||
private initFieldName; | ||
@@ -36,0 +37,0 @@ private initManyToOneFieldName; |
@@ -364,2 +364,18 @@ "use strict"; | ||
} | ||
initOwnColumns(meta) { | ||
meta.sync(); | ||
for (const prop of meta.props) { | ||
if (!prop.joinColumns || prop.ownColumns) { | ||
continue; | ||
} | ||
if (prop.joinColumns.length > 1) { | ||
prop.ownColumns = prop.joinColumns.filter(col => { | ||
return !meta.props.find(p => p.name !== prop.name && (!p.fieldNames || p.fieldNames.includes(col))); | ||
}); | ||
} | ||
if (!prop.ownColumns || prop.ownColumns.length === 0) { | ||
prop.ownColumns = prop.joinColumns; | ||
} | ||
} | ||
} | ||
initFieldName(prop, object = false) { | ||
@@ -473,2 +489,3 @@ if (prop.fieldNames && prop.fieldNames.length > 0) { | ||
} | ||
this.initOwnColumns(meta); | ||
meta.simplePK = pks.length === 1 && pks[0].kind === enums_1.ReferenceKind.SCALAR && !pks[0].customType && pks[0].runtimeType !== 'Date'; | ||
@@ -475,0 +492,0 @@ meta.serializedPrimaryKey = this.platform.getSerializedPrimaryKeyField(meta.primaryKeys[0]); |
{ | ||
"name": "@mikro-orm/core", | ||
"version": "6.3.14-dev.52", | ||
"version": "6.3.14-dev.53", | ||
"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.", | ||
@@ -67,5 +67,5 @@ "main": "index.js", | ||
"globby": "11.1.0", | ||
"mikro-orm": "6.3.14-dev.52", | ||
"mikro-orm": "6.3.14-dev.53", | ||
"reflect-metadata": "0.2.2" | ||
} | ||
} |
@@ -368,2 +368,3 @@ import type { Transaction } from './connections'; | ||
joinColumns: string[]; | ||
ownColumns: string[]; | ||
inverseJoinColumns: string[]; | ||
@@ -370,0 +371,0 @@ referencedColumnNames: string[]; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1079260
24003
+ Addedmikro-orm@6.3.14-dev.53(transitive)
- Removedmikro-orm@6.3.14-dev.52(transitive)
Updatedmikro-orm@6.3.14-dev.53