@mikro-orm/sql 7.1.2-dev.13 → 7.1.2-dev.15

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.
@@ -126,6 +126,11 @@ export class BasePostgreSqlPlatform extends AbstractSqlPlatform {
126
126
  if (['interval'].includes(simpleType)) {
127
127
  return this.getIntervalTypeDeclarationSQL(options);
128
128
  }
129
+ // postgis reports the typmod without spaces (`geometry(point,4326)`) — collapse any
130
+ // user-supplied spacing so the metadata and introspection forms compare equal
131
+ if (['geometry', 'geography'].includes(simpleType)) {
132
+ return type.toLowerCase().replace(/\s+/g, '');
133
+ }
129
134
  // TimeType.getColumnType drops the timezone qualifier, so detect tz aliases from the original column type.
130
135
  const originalType = options.columnTypes?.[0]?.toLowerCase() ?? type;
131
136
  if (/^timetz\b/.test(originalType) || /^time\s+with\s+time\s+zone\b/.test(originalType)) {
@@ -370,6 +370,7 @@ export class PostgreSqlSchemaHelper extends SchemaHelper {
370
370
  is_nullable,
371
371
  udt_name,
372
372
  udt_schema,
373
+ pg_catalog.format_type(pga.atttypid, pga.atttypmod) format_type,
373
374
  coalesce(datetime_precision, character_maximum_length) length,
374
375
  atttypmod custom_length,
375
376
  numeric_precision,
@@ -404,6 +405,11 @@ export class PostgreSqlSchemaHelper extends SchemaHelper {
404
405
  if (type === 'bpchar') {
405
406
  type = 'char';
406
407
  }
408
+ // postgis stores the geometry/geography typmod (`geometry(point,4326)`) in atttypmod, which
409
+ // information_schema does not expose — recover the full type via format_type so it round-trips
410
+ if ((col.udt_name === 'geometry' || col.udt_name === 'geography') && col.format_type) {
411
+ type = col.format_type;
412
+ }
407
413
  if (type === 'vector' && col.length == null && col.custom_length != null && col.custom_length !== -1) {
408
414
  col.length = col.custom_length;
409
415
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.1.2-dev.13",
3
+ "version": "7.1.2-dev.15",
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.1.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.1.2-dev.13"
56
+ "@mikro-orm/core": "7.1.2-dev.15"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"
@@ -233,7 +233,9 @@ export class DatabaseSchema {
233
233
  ? platform.formatQuery(check.expression.sql, check.expression.params)
234
234
  : check.expression;
235
235
  table.addCheck({
236
- name: check.name,
236
+ // the engine truncates identifiers past its limit (postgres 63 bytes) on storage, so
237
+ // mirror that here — otherwise the introspected (truncated) name never matches metadata
238
+ name: check.name.substring(0, platform.getMaxIdentifierLength()),
237
239
  expression,
238
240
  definition: `check (${expression})`,
239
241
  columnName,