@mikro-orm/knex 6.1.10-dev.13 → 6.1.10-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.
@@ -55,8 +55,11 @@ class AbstractSqlPlatform extends core_1.Platform {
55
55
  getJsonIndexDefinition(index) {
56
56
  return index.columnNames
57
57
  .map(column => {
58
+ if (!column.includes('.')) {
59
+ return column;
60
+ }
58
61
  const [root, ...path] = column.split('.');
59
- return `json_extract(${root}, '$.${path.join('.')}')`;
62
+ return `(json_extract(${root}, '$.${path.join('.')}'))`;
60
63
  });
61
64
  }
62
65
  isRaw(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.1.10-dev.13",
3
+ "version": "6.1.10-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
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -66,6 +66,6 @@
66
66
  "@mikro-orm/core": "^6.1.9"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.1.10-dev.13"
69
+ "@mikro-orm/core": "6.1.10-dev.14"
70
70
  }
71
71
  }
@@ -498,7 +498,7 @@ class SqlSchemaGenerator extends core_1.AbstractSchemaGenerator {
498
498
  // JSON columns can have unique index but not unique constraint, and we need to distinguish those, so we can properly drop them
499
499
  if (index.columnNames.some(column => column.includes('.'))) {
500
500
  const columns = this.platform.getJsonIndexDefinition(index);
501
- table.index(columns.map(column => this.knex.raw(`(${column})`)), index.keyName, { indexType: 'unique' });
501
+ table.index(columns.map(column => this.knex.raw(column)), index.keyName, { indexType: 'unique' });
502
502
  }
503
503
  else {
504
504
  table.unique(index.columnNames, { indexName: index.keyName });
@@ -517,7 +517,7 @@ class SqlSchemaGenerator extends core_1.AbstractSchemaGenerator {
517
517
  // JSON columns can have unique index but not unique constraint, and we need to distinguish those, so we can properly drop them
518
518
  if (index.columnNames.some(column => column.includes('.'))) {
519
519
  const columns = this.platform.getJsonIndexDefinition(index);
520
- table.index(columns.map(column => this.knex.raw(`(${column})`)), index.keyName, index.type);
520
+ table.index(columns.map(column => this.knex.raw(column)), index.keyName, index.type);
521
521
  }
522
522
  else {
523
523
  table.index(index.columnNames, index.keyName, index.type);