@mikro-orm/sql 7.0.7-dev.14 → 7.0.7-dev.16

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.
@@ -520,6 +520,9 @@ export class PostgreSqlSchemaHelper extends SchemaHelper {
520
520
  if (parts.length === 2 && parts[0] === '*') {
521
521
  columnType = `${table.schema}.${parts[1]}`;
522
522
  }
523
+ else if (parts.length === 1) {
524
+ columnType = this.getTableName(column.type, table.schema);
525
+ }
523
526
  if (columnType.endsWith('[]')) {
524
527
  columnType = this.quote(columnType.substring(0, columnType.length - 2)) + '[]';
525
528
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.0.7-dev.14",
3
+ "version": "7.0.7-dev.16",
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.0.6"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.0.7-dev.14"
56
+ "@mikro-orm/core": "7.0.7-dev.16"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"
@@ -302,7 +302,14 @@ export class SchemaHelper {
302
302
  if (changedProperties.has('type')) {
303
303
  let type = column.type + (column.generated ? ` generated always as ${column.generated}` : '');
304
304
  if (column.nativeEnumName) {
305
- type = this.quote(this.getTableName(type, table.schema));
305
+ const parts = type.split('.');
306
+ if (parts.length === 2 && parts[0] === '*' && table.schema) {
307
+ type = `${table.schema}.${parts[1]}`;
308
+ }
309
+ else if (parts.length === 1) {
310
+ type = this.getTableName(type, table.schema);
311
+ }
312
+ type = this.quote(type);
306
313
  }
307
314
  sql.push(`alter table ${table.getQuotedName()} alter column ${this.quote(column.name)} type ${type + this.castColumn(column.name, type)}`);
308
315
  }
@@ -178,8 +178,8 @@ export class SqlSchemaGenerator extends AbstractSchemaGenerator {
178
178
  this.append(ret, this.helper.dropTableIfExists(meta.tableName, this.getSchemaName(meta, options)));
179
179
  }
180
180
  if (this.platform.supportsNativeEnums()) {
181
- for (const columnName of Object.keys(schema.getNativeEnums())) {
182
- const sql = this.helper.getDropNativeEnumSQL(columnName, options.schema ?? this.config.get('schema'));
181
+ for (const enumOptions of Object.values(schema.getNativeEnums())) {
182
+ const sql = this.helper.getDropNativeEnumSQL(enumOptions.name, this.getSchemaName(enumOptions, options));
183
183
  this.append(ret, sql);
184
184
  }
185
185
  }