@mikro-orm/knex 6.0.0-dev.179 → 6.0.0-dev.180

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/knex",
3
- "version": "6.0.0-dev.179",
3
+ "version": "6.0.0-dev.180",
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
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -66,6 +66,6 @@
66
66
  "@mikro-orm/core": "^5.9.2"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.0.0-dev.179"
69
+ "@mikro-orm/core": "6.0.0-dev.180"
70
70
  }
71
71
  }
@@ -175,7 +175,10 @@ class DatabaseTable {
175
175
  }
176
176
  const properties = this.getIndexProperties(index, columnFks, fksOnColumnProps, fksOnStandaloneProps, namingStrategy);
177
177
  // If there is a column that cannot be unambiguously mapped to a prop, render an expression.
178
- if (typeof properties === 'undefined') {
178
+ if (index.expression) {
179
+ ret.expression = index.expression;
180
+ }
181
+ else if (typeof properties === 'undefined') {
179
182
  ret.expression = schemaHelper.getCreateIndexSQL(this.name, index);
180
183
  }
181
184
  else {
@@ -549,6 +552,9 @@ class DatabaseTable {
549
552
  }
550
553
  field = replacedFieldName;
551
554
  }
555
+ if (field.startsWith('_')) {
556
+ return field;
557
+ }
552
558
  return namingStrategy.columnNameToProperty(field);
553
559
  }
554
560
  getPropertyTypeForForeignKey(namingStrategy, fk) {