orchid-orm 1.71.1 → 1.72.1

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.
@@ -0,0 +1,14 @@
1
+ import { ColumnSchemaConfig } from "pqb/internal";
2
+ export * from "rake-db/bun";
3
+ declare module 'rake-db' {
4
+ interface RakeDbConfig {
5
+ dbPath?: string;
6
+ dbExportedAs?: string;
7
+ generateTableTo?(tableName: string): string;
8
+ }
9
+ interface RakeDbCliConfigInputBase<SchemaConfig extends ColumnSchemaConfig, CT> {
10
+ dbPath?: string;
11
+ dbExportedAs?: string;
12
+ generateTableTo?(tableName: string): string;
13
+ }
14
+ }
@@ -0,0 +1,12 @@
1
+ (0, require("orchid-orm/migrations").patchRakeDb)();
2
+ var rake_db_bun = require("rake-db/bun");
3
+ Object.keys(rake_db_bun).forEach(function(k) {
4
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function() {
7
+ return rake_db_bun[k];
8
+ }
9
+ });
10
+ });
11
+
12
+ //# sourceMappingURL=bun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun.js","names":[],"sources":["../../src/migrations/adapters/bun.ts"],"sourcesContent":["import { patchRakeDb } from 'orchid-orm/migrations';\nexport * from '../patch-rake-db-types';\nexport * from 'rake-db/bun';\n\npatchRakeDb();\n"],"mappings":"mDAIa"}
@@ -0,0 +1,5 @@
1
+ import { patchRakeDb } from "orchid-orm/migrations";
2
+ export * from "rake-db/bun";
3
+ patchRakeDb();
4
+
5
+ //# sourceMappingURL=bun.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun.mjs","names":[],"sources":["../../src/migrations/adapters/bun.ts"],"sourcesContent":["import { patchRakeDb } from 'orchid-orm/migrations';\nexport * from '../patch-rake-db-types';\nexport * from 'rake-db/bun';\n\npatchRakeDb();\n"],"mappings":";;AAIA,aAAa"}
@@ -41,7 +41,7 @@ const compareSqlExpressions = async (tableExpressions, adapter) => {
41
41
  ].join("; ");
42
42
  const query = () => adapter.query(combinedQueries, values);
43
43
  const result = await (adapter.isInTransaction() ? adapter.savepoint(viewName, query) : query()).then((res) => res[1], async (err) => {
44
- if (err.code !== "42704") throw err;
44
+ if (typeof err === "object" && (0, pqb_internal.getDriverErrorCode)(err) !== "42704") throw err;
45
45
  });
46
46
  if (!result) {
47
47
  handle();
@@ -369,7 +369,7 @@ const compareColumns = async (adapter, domainsMap, ast, currentSchema, compareSq
369
369
  const getTypeCasts = async (adapter, typeCastsCache) => {
370
370
  let typeCasts = typeCastsCache.value;
371
371
  if (!typeCasts) {
372
- const { rows } = await adapter.arrays(`SELECT s.typname, t.typname
372
+ const { rows } = await adapter.arrays(`SELECT s.typname s, t.typname t
373
373
  FROM pg_cast
374
374
  JOIN pg_type AS s ON s.oid = castsource
375
375
  JOIN pg_type AS t ON t.oid = casttarget`);
@@ -1753,7 +1753,7 @@ const getColumnDbTypeForComparison = (column, currentSchema) => {
1753
1753
  const freezeSqlClock = (sql) => sql.replaceAll("clock_timestamp()", `'0.1ms'::interval + now()`);
1754
1754
  const applyCompareSql = async (compareSql, adapter) => {
1755
1755
  if (compareSql.expressions.length) {
1756
- const { rows: [results] } = await adapter.arrays("SELECT " + compareSql.expressions.map((x) => `${freezeSqlClock(x.inDb)} = (${x.inCode && freezeSqlClock(x.inCode)})`).join(", "), compareSql.values);
1756
+ const { rows: [results] } = await adapter.arrays("SELECT " + compareSql.expressions.map((x, i) => `${freezeSqlClock(x.inDb)} = (${x.inCode && freezeSqlClock(x.inCode)}) "${i}"`).join(", "), compareSql.values);
1757
1757
  for (let i = 0; i < results.length; i++) if (!results[i]) compareSql.expressions[i].change();
1758
1758
  }
1759
1759
  };
@@ -2945,7 +2945,7 @@ const getActualItems = async (db, currentSchema, internal, columnTypes) => {
2945
2945
  domains.set(column.dataType, {
2946
2946
  schemaName,
2947
2947
  name,
2948
- column: column.data.as ?? new pqb_internal.UnknownColumn(pqb_internal.defaultSchemaConfig)
2948
+ column: column.data.as ?? pqb_internal.UnknownColumn.instance
2949
2949
  });
2950
2950
  } else {
2951
2951
  const en = column.dataType === "enum" ? column : column instanceof pqb_internal.ArrayColumn && column.data.item.dataType === "enum" ? column.data.item : void 0;