orchid-orm 1.58.4 → 1.58.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.
@@ -1,5 +1,5 @@
1
1
  import { promptSelect, getSchemaAndTableFromName, getDbTableColumnsChecks, dbColumnToAst, instantiateDbColumn, concatSchemaAndName, encodeColumnDefault, getIndexName, getExcludeName, getConstraintName, tableToAst, getDbStructureTableData, makeDomainsMap, astToMigration, createMigrationInterface, introspectDbSchema, makeStructureToAstCtx, makeFileVersion, writeMigrationFile, migrateAndClose, migrate, structureToAst, saveMigratedVersion, rakeDbCommands } from 'rake-db';
2
- import { noop, colors, EnumColumn, ArrayColumn, toSnakeCase, getColumnBaseType, deepCompare, RawSQL, emptyArray, toArray, getFreeSetAlias, VirtualColumn, exhaustive, toCamelCase, addCode, pluralize, codeToString, DomainColumn, UnknownColumn, defaultSchemaConfig, toPascalCase, getImportPath, singleQuote, columnsShapeToCode, pushTableDataCode, quoteObjectKey, pathToLog } from 'pqb';
2
+ import { colors, EnumColumn, ArrayColumn, toSnakeCase, getColumnBaseType, deepCompare, RawSQL, emptyArray, toArray, getFreeSetAlias, VirtualColumn, exhaustive, toCamelCase, addCode, pluralize, codeToString, DomainColumn, UnknownColumn, defaultSchemaConfig, toPascalCase, getImportPath, singleQuote, columnsShapeToCode, pushTableDataCode, quoteObjectKey, pathToLog } from 'pqb';
3
3
  import path from 'node:path';
4
4
  import { pathToFileURL } from 'url';
5
5
  import fs from 'fs/promises';
@@ -22,7 +22,14 @@ const compareSqlExpressions = async (tableExpressions, adapter) => {
22
22
  `SELECT pg_get_viewdef('${viewName}') v`,
23
23
  `DROP VIEW ${viewName}`
24
24
  ].join("; ");
25
- const result = await adapter.query(combinedQueries, values).then((res) => res[1], noop);
25
+ const result = await adapter.query(combinedQueries, values).then(
26
+ (res) => res[1],
27
+ (err) => {
28
+ if (err.code !== "42704") {
29
+ throw err;
30
+ }
31
+ }
32
+ );
26
33
  if (!result) {
27
34
  handle();
28
35
  return;
@@ -604,15 +611,13 @@ const getColumnDbType = (column, currentSchema) => {
604
611
  let type = item instanceof EnumColumn ? item.enumName : item.dataType;
605
612
  type = type.startsWith(currentSchema + ".") ? type.slice(currentSchema.length + 1) : type;
606
613
  return type + "[]".repeat(column.data.arrayDims);
607
- } else if (column.data.isOfCustomType) {
614
+ } else {
608
615
  let type = column.dataType;
609
616
  const i = type.indexOf("(");
610
617
  if (i !== -1) {
611
618
  type = type.slice(0, i);
612
619
  }
613
- return type.includes(".") ? type : currentSchema + "." + type;
614
- } else {
615
- return column.dataType;
620
+ return column.data.isOfCustomType ? type.includes(".") ? type : currentSchema + "." + type : type;
616
621
  }
617
622
  };
618
623
  const getColumnDbTypeQuoted = (column, currentSchema) => {