@mikro-orm/sql 7.2.13-dev.10 → 7.2.13-dev.12

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.
@@ -99,10 +99,10 @@ export class AbstractSqlDriver extends DatabaseDriver {
99
99
  }
100
100
  }
101
101
  if (options.collation != null && typeof options.collation !== 'string') {
102
- throw new Error('Collation option for SQL drivers must be a string (collation name). Use a CollationOptions object only with MongoDB.');
102
+ throw new ValidationError('Collation option for SQL drivers must be a string (collation name). Use a CollationOptions object only with MongoDB.');
103
103
  }
104
104
  if (options.indexHint != null && typeof options.indexHint !== 'string') {
105
- throw new Error("indexHint for SQL drivers must be a string (e.g. 'force index(my_index)'). Use an object only with MongoDB.");
105
+ throw new ValidationError("indexHint for SQL drivers must be a string (e.g. 'force index(my_index)'). Use an object only with MongoDB.");
106
106
  }
107
107
  }
108
108
  createEntityManager(useContext) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.2.13-dev.10",
3
+ "version": "7.2.13-dev.12",
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.2.12"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.2.13-dev.10"
56
+ "@mikro-orm/core": "7.2.13-dev.12"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"
@@ -301,12 +301,15 @@ export class SchemaComparator {
301
301
  }
302
302
  /** Engines drop length/precision modifiers and use different aliases for the same logical type — canonicalise both sides. */
303
303
  normaliseParamType(type) {
304
- const lengthMatch = /^([^()]+)\(([^)]*)\)\s*$/.exec(type);
305
- const base = (lengthMatch ? lengthMatch[1] : type).trim().toLowerCase();
304
+ const lower = type.trim().toLowerCase();
305
+ const array = /\[\d*\]$/.test(lower);
306
+ const element = array ? lower.slice(0, lower.indexOf('[')) : lower;
307
+ const open = element.indexOf('(');
308
+ const close = element.indexOf(')', open);
309
+ const stripped = open < 0 || close < 0 ? element : element.slice(0, open) + element.slice(close + 1);
310
+ const base = stripped.replace(/\s+/g, ' ').trim();
306
311
  const aliased = SchemaComparator.PARAM_TYPE_ALIASES[base] ?? base;
307
- const length = lengthMatch ? Number.parseInt(lengthMatch[2].split(',')[0].trim(), 10) : NaN;
308
- const options = Number.isFinite(length) ? { length } : {};
309
- return this.#platform.normalizeColumnType(aliased, options).toLowerCase();
312
+ return this.#platform.normalizeColumnType(aliased, {}).toLowerCase() + (array ? '[]' : '');
310
313
  }
311
314
  static PARAM_TYPE_ALIASES = {
312
315
  int: 'integer',
@@ -315,7 +318,11 @@ export class SchemaComparator {
315
318
  int2: 'smallint',
316
319
  bool: 'boolean',
317
320
  'character varying': 'varchar',
321
+ character: 'char',
318
322
  bpchar: 'char',
323
+ 'bit varying': 'varbit',
324
+ 'time without time zone': 'time',
325
+ 'timestamp without time zone': 'timestamp',
319
326
  float8: 'double precision',
320
327
  float4: 'real',
321
328
  // Oracle's USER_ARGUMENTS reports `REF CURSOR`; users declare `sys_refcursor`.