@mikro-orm/sql 7.2.9-dev.4 → 7.2.9-dev.5

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/sql",
3
- "version": "7.2.9-dev.4",
3
+ "version": "7.2.9-dev.5",
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.8"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.2.9-dev.4"
56
+ "@mikro-orm/core": "7.2.9-dev.5"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"
@@ -92,6 +92,7 @@ export declare class SchemaComparator {
92
92
  private diffPolicy;
93
93
  parseJsonDefault(defaultValue?: string | null): Dictionary | string | null;
94
94
  private parseDecimalDefault;
95
+ private parseBigIntDefault;
95
96
  hasSameDefaultValue(from: Column, to: Column): boolean;
96
97
  private mapColumnToProperty;
97
98
  private log;
@@ -1,4 +1,4 @@
1
- import { ArrayType, BooleanType, DateTimeType, DecimalType, inspect, JsonType, parseJsonSafe, Utils, } from '@mikro-orm/core';
1
+ import { ArrayType, BigIntType, BooleanType, DateTimeType, DecimalType, inspect, JsonType, parseJsonSafe, Utils, } from '@mikro-orm/core';
2
2
  import { DatabaseTable } from './DatabaseTable.js';
3
3
  import { diffPartitioning } from './partitioning.js';
4
4
  /**
@@ -1098,6 +1098,10 @@ export class SchemaComparator {
1098
1098
  const value = +('' + defaultValue).replace(/^'(.+)'$/, '$1');
1099
1099
  return Number.isFinite(value) ? value : null;
1100
1100
  }
1101
+ parseBigIntDefault(defaultValue) {
1102
+ const value = ('' + defaultValue).replace(/^'(.+)'$/, '$1');
1103
+ return /^-?\d+$/.test(value) ? BigInt(value) : null;
1104
+ }
1101
1105
  hasSameDefaultValue(from, to) {
1102
1106
  if (from.default == null ||
1103
1107
  from.default.toString().toLowerCase() === 'null' ||
@@ -1133,6 +1137,14 @@ export class SchemaComparator {
1133
1137
  this.#platform.formatDecimal(defaultValueTo, to.scale));
1134
1138
  }
1135
1139
  }
1140
+ // metadata quotes bigint defaults (`'0'`) while mysql reports them bare
1141
+ if (to.mappedType instanceof BigIntType) {
1142
+ const defaultValueFrom = this.parseBigIntDefault(from.default);
1143
+ const defaultValueTo = this.parseBigIntDefault(to.default);
1144
+ if (defaultValueFrom != null && defaultValueTo != null) {
1145
+ return defaultValueFrom === defaultValueTo;
1146
+ }
1147
+ }
1136
1148
  if (from.default && to.default) {
1137
1149
  return from.default.toString().toLowerCase() === to.default.toString().toLowerCase();
1138
1150
  }