@mikro-orm/core 6.4.16-dev.11 → 6.4.16-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.
@@ -1004,7 +1004,7 @@ class MetadataDiscovery {
1004
1004
  return o;
1005
1005
  }, {});
1006
1006
  }
1007
- getDefaultVersionValue(prop) {
1007
+ getDefaultVersionValue(meta, prop) {
1008
1008
  if (typeof prop.defaultRaw !== 'undefined') {
1009
1009
  return prop.defaultRaw;
1010
1010
  }
@@ -1012,7 +1012,9 @@ class MetadataDiscovery {
1012
1012
  if (prop.default != null) {
1013
1013
  return '' + this.platform.quoteVersionValue(prop.default, prop);
1014
1014
  }
1015
- if (prop.type.toLowerCase() === 'date') {
1015
+ this.initCustomType(meta, prop, true);
1016
+ const type = prop.customType?.runtimeType ?? prop.runtimeType ?? prop.type;
1017
+ if (type === 'Date') {
1016
1018
  prop.length ??= this.platform.getDefaultVersionLength();
1017
1019
  return this.platform.getCurrentTimestampSQL(prop.length);
1018
1020
  }
@@ -1083,13 +1085,13 @@ class MetadataDiscovery {
1083
1085
  if (prop.version) {
1084
1086
  this.initDefaultValue(prop);
1085
1087
  meta.versionProperty = prop.name;
1086
- prop.defaultRaw = this.getDefaultVersionValue(prop);
1088
+ prop.defaultRaw = this.getDefaultVersionValue(meta, prop);
1087
1089
  }
1088
1090
  if (prop.concurrencyCheck && !prop.primary) {
1089
1091
  meta.concurrencyCheckKeys.add(prop.name);
1090
1092
  }
1091
1093
  }
1092
- initCustomType(meta, prop) {
1094
+ initCustomType(meta, prop, simple = false) {
1093
1095
  // `prop.type` might be actually instance of custom type class
1094
1096
  if (types_1.Type.isMappedType(prop.type) && !prop.customType) {
1095
1097
  prop.customType = prop.type;
@@ -1100,6 +1102,9 @@ class MetadataDiscovery {
1100
1102
  prop.customType = new prop.type();
1101
1103
  prop.type = prop.customType.constructor.name;
1102
1104
  }
1105
+ if (simple) {
1106
+ return;
1107
+ }
1103
1108
  if (!prop.customType && ['json', 'jsonb'].includes(prop.type?.toLowerCase())) {
1104
1109
  prop.customType = new types_1.JsonType();
1105
1110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.4.16-dev.11",
3
+ "version": "6.4.16-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
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.3.0",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.4.16-dev.11",
67
+ "mikro-orm": "6.4.16-dev.12",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }