@mikro-orm/core 7.2.6-dev.19 → 7.2.6-dev.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.2.6-dev.19",
3
+ "version": "7.2.6-dev.20",
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",
package/typings.js CHANGED
@@ -304,8 +304,11 @@ export class EntityMetadata {
304
304
  }, { __gettersDefined: { value: true, enumerable: false } });
305
305
  }
306
306
  initIndexes(prop) {
307
- const simpleIndex = this.indexes.find(index => index.properties === prop.name && !index.options && !index.type && !index.expression && index.where == null);
308
- const simpleUnique = this.uniques.find(index => index.properties === prop.name && !index.options && !index.expression && index.where == null);
307
+ // `prop.index`/`prop.unique` keep only the name, so an index with any other option must stay in `meta.indexes`
308
+ const isSimple = (index) => index.properties === prop.name &&
309
+ Object.entries(index).every(([key, value]) => key === 'name' || key === 'properties' || value == null);
310
+ const simpleIndex = this.indexes.find(isSimple);
311
+ const simpleUnique = this.uniques.find(isSimple);
309
312
  const owner = prop.kind === ReferenceKind.MANY_TO_ONE;
310
313
  if (!prop.index && simpleIndex) {
311
314
  Utils.defaultValue(simpleIndex, 'name', true);
package/utils/Utils.js CHANGED
@@ -153,7 +153,7 @@ export function parseJsonSafe(value) {
153
153
  /** Collection of general-purpose utility methods used throughout the ORM. */
154
154
  export class Utils {
155
155
  static PK_SEPARATOR = '~~~';
156
- static #ORM_VERSION = '7.2.6-dev.19';
156
+ static #ORM_VERSION = '7.2.6-dev.20';
157
157
  /** Default session variable name backing an RLS filter argument (`current_setting('mikro.<filter>.<arg>')`). */
158
158
  static getRlsSettingName(filterName, argName) {
159
159
  return `mikro.${filterName}.${argName}`;