@mikro-orm/core 7.0.13-dev.7 → 7.0.13-dev.9

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.0.13-dev.7",
3
+ "version": "7.0.13-dev.9",
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",
@@ -168,7 +168,7 @@ export declare abstract class Platform {
168
168
  getUuidTypeDeclarationSQL(column: {
169
169
  length?: number;
170
170
  }): string;
171
- /** Extracts the base type name from a full SQL type declaration (e.g. "varchar(255)" -> "varchar"). */
171
+ /** Extracts the base type name from a full SQL type declaration (e.g. `varchar(255)` -> `varchar`). */
172
172
  extractSimpleType(type: string): string;
173
173
  /**
174
174
  * This should be used only to compare types, it can strip some information like the length.
@@ -8,6 +8,15 @@ import { ReferenceKind } from '../enums.js';
8
8
  import { Raw } from '../utils/RawQueryFragment.js';
9
9
  /** Symbol used to tag cloned embeddable data for JSON serialization handling. */
10
10
  export const JsonProperty = Symbol('JsonProperty');
11
+ const MULTI_WORD_SQL_TYPES = [
12
+ 'timestamp with time zone',
13
+ 'timestamp without time zone',
14
+ 'time with time zone',
15
+ 'time without time zone',
16
+ 'character varying',
17
+ 'double precision',
18
+ 'bit varying',
19
+ ];
11
20
  /** Abstract base class providing database-specific behavior and SQL dialect differences. */
12
21
  export class Platform {
13
22
  exceptionConverter = new ExceptionConverter();
@@ -222,9 +231,15 @@ export class Platform {
222
231
  column.length ??= 36;
223
232
  return this.getVarcharTypeDeclarationSQL(column);
224
233
  }
225
- /** Extracts the base type name from a full SQL type declaration (e.g. "varchar(255)" -> "varchar"). */
234
+ /** Extracts the base type name from a full SQL type declaration (e.g. `varchar(255)` -> `varchar`). */
226
235
  extractSimpleType(type) {
227
- return /[^(), ]+/.exec(type.toLowerCase())[0];
236
+ const lower = type.toLowerCase();
237
+ for (const multiWord of MULTI_WORD_SQL_TYPES) {
238
+ if (lower.startsWith(multiWord)) {
239
+ return multiWord;
240
+ }
241
+ }
242
+ return /[^(), ]+/.exec(lower)[0];
228
243
  }
229
244
  /**
230
245
  * This should be used only to compare types, it can strip some information like the length.
@@ -248,6 +263,7 @@ export class Platform {
248
263
  return Type.getType(CharacterType);
249
264
  case 'string':
250
265
  case 'varchar':
266
+ case 'character varying':
251
267
  return Type.getType(StringType);
252
268
  case 'interval':
253
269
  return Type.getType(IntervalType);
@@ -267,6 +283,7 @@ export class Platform {
267
283
  case 'float':
268
284
  return Type.getType(FloatType);
269
285
  case 'double':
286
+ case 'double precision':
270
287
  return Type.getType(DoubleType);
271
288
  case 'integer':
272
289
  return Type.getType(IntegerType);
@@ -286,8 +303,12 @@ export class Platform {
286
303
  return Type.getType(DateType);
287
304
  case 'datetime':
288
305
  case 'timestamp':
306
+ case 'timestamp with time zone':
307
+ case 'timestamp without time zone':
289
308
  return Type.getType(DateTimeType);
290
309
  case 'time':
310
+ case 'time with time zone':
311
+ case 'time without time zone':
291
312
  return Type.getType(TimeType);
292
313
  case 'object':
293
314
  case 'json':
package/utils/Utils.js CHANGED
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
141
141
  /** Collection of general-purpose utility methods used throughout the ORM. */
142
142
  export class Utils {
143
143
  static PK_SEPARATOR = '~~~';
144
- static #ORM_VERSION = '7.0.13-dev.7';
144
+ static #ORM_VERSION = '7.0.13-dev.9';
145
145
  /**
146
146
  * Checks if the argument is instance of `Object`. Returns false for arrays.
147
147
  */