@mikro-orm/knex 6.0.0-dev.80 → 6.0.0-dev.81

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.
@@ -171,6 +171,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
171
171
  }
172
172
  return;
173
173
  }
174
+ const tz = this.platform.getTimezone();
174
175
  meta2.props
175
176
  .filter(prop => this.platform.shouldHaveColumn(prop, p.children || []))
176
177
  .forEach(prop => {
@@ -178,6 +179,11 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
178
179
  relationPojo[prop.name] = prop.fieldNames.map(name => root[`${relationAlias}__${name}`]);
179
180
  prop.fieldNames.map(name => delete root[`${relationAlias}__${name}`]);
180
181
  }
182
+ else if (prop.runtimeType === 'Date') {
183
+ const alias = `${relationAlias}__${prop.fieldNames[0]}`;
184
+ relationPojo[prop.name] = (typeof root[alias] === 'string' ? new Date(root[alias]) : root[alias]);
185
+ delete root[alias];
186
+ }
181
187
  else {
182
188
  const alias = `${relationAlias}__${prop.fieldNames[0]}`;
183
189
  relationPojo[prop.name] = root[alias];
@@ -415,7 +421,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
415
421
  const versionProperty = meta.properties[meta.versionProperty];
416
422
  const quotedFieldName = this.platform.quoteIdentifier(versionProperty.fieldNames[0]);
417
423
  sql += `${quotedFieldName} = `;
418
- if (versionProperty.type.toLowerCase() === 'date') {
424
+ if (versionProperty.runtimeType === 'Date') {
419
425
  sql += this.platform.getCurrentTimestampSQL(versionProperty.length);
420
426
  }
421
427
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.0.0-dev.80",
3
+ "version": "6.0.0-dev.81",
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.7.10"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "~6.0.0-dev.80"
69
+ "@mikro-orm/core": "~6.0.0-dev.81"
70
70
  }
71
71
  }
@@ -515,7 +515,7 @@ class QueryBuilderHelper {
515
515
  }
516
516
  const versionProperty = meta.properties[meta.versionProperty];
517
517
  let sql = this.platform.quoteIdentifier(versionProperty.fieldNames[0]) + ' + 1';
518
- if (versionProperty.type.toLowerCase() === 'date') {
518
+ if (versionProperty.runtimeType === 'Date') {
519
519
  sql = this.platform.getCurrentTimestampSQL(versionProperty.length);
520
520
  }
521
521
  qb.update(versionProperty.fieldNames[0], this.knex.raw(sql));