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.
- package/dist/bun.d.ts +17 -0
- package/dist/bun.js +31 -0
- package/dist/bun.js.map +1 -0
- package/dist/bun.mjs +21 -0
- package/dist/bun.mjs.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +23 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -20
- package/dist/index.mjs.map +1 -1
- package/dist/migrations/bun.d.ts +14 -0
- package/dist/migrations/bun.js +12 -0
- package/dist/migrations/bun.js.map +1 -0
- package/dist/migrations/bun.mjs +5 -0
- package/dist/migrations/bun.mjs.map +1 -0
- package/dist/migrations/index.js +4 -4
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/index.mjs +5 -5
- package/dist/migrations/index.mjs.map +1 -1
- package/dist/node-postgres.d.ts +2 -2
- package/dist/node-postgres.js +6 -0
- package/dist/node-postgres.js.map +1 -1
- package/dist/node-postgres.mjs +2 -2
- package/dist/node-postgres.mjs.map +1 -1
- package/package.json +28 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { astToMigration, concatSchemaAndName, createMigrationInterface, dbColumnToAst, encodeColumnDefault, getConstraintName, getDbStructureTableData, getDbTableColumnsChecks, getDbVersion, getExcludeName, getIndexName, getMigrationsSchemaAndTable, getSchemaAndTableFromName, instantiateDbColumn, introspectDbSchema, makeDomainsMap, makeFileVersion, makeStructureToAstCtx, migrate, migrateAndClose, promptSelect, rakeDbCommands, saveMigratedVersion, structureToAst, tableToAst, writeMigrationFile } from "rake-db";
|
|
2
|
-
import { ArrayColumn, DomainColumn, EnumColumn, RawSql, UnknownColumn, VirtualColumn, addCode, codeToString, colors, columnsShapeToCode, deepCompare,
|
|
2
|
+
import { ArrayColumn, DomainColumn, EnumColumn, RawSql, UnknownColumn, VirtualColumn, addCode, codeToString, colors, columnsShapeToCode, deepCompare, emptyArray, emptyObject, exhaustive, getColumnBaseType, getDriverErrorCode, getFreeSetAlias, getImportPath, getQuerySchema, getSupportedDefaultPrivileges, pathToLog, pluralize, pushTableDataCode, quoteObjectKey, singleQuote, toArray, toCamelCase, toPascalCase, toSnakeCase } from "pqb/internal";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
@@ -18,7 +18,7 @@ const compareSqlExpressions = async (tableExpressions, adapter) => {
|
|
|
18
18
|
].join("; ");
|
|
19
19
|
const query = () => adapter.query(combinedQueries, values);
|
|
20
20
|
const result = await (adapter.isInTransaction() ? adapter.savepoint(viewName, query) : query()).then((res) => res[1], async (err) => {
|
|
21
|
-
if (err
|
|
21
|
+
if (typeof err === "object" && getDriverErrorCode(err) !== "42704") throw err;
|
|
22
22
|
});
|
|
23
23
|
if (!result) {
|
|
24
24
|
handle();
|
|
@@ -346,7 +346,7 @@ const compareColumns = async (adapter, domainsMap, ast, currentSchema, compareSq
|
|
|
346
346
|
const getTypeCasts = async (adapter, typeCastsCache) => {
|
|
347
347
|
let typeCasts = typeCastsCache.value;
|
|
348
348
|
if (!typeCasts) {
|
|
349
|
-
const { rows } = await adapter.arrays(`SELECT s.typname, t.typname
|
|
349
|
+
const { rows } = await adapter.arrays(`SELECT s.typname s, t.typname t
|
|
350
350
|
FROM pg_cast
|
|
351
351
|
JOIN pg_type AS s ON s.oid = castsource
|
|
352
352
|
JOIN pg_type AS t ON t.oid = casttarget`);
|
|
@@ -1730,7 +1730,7 @@ const getColumnDbTypeForComparison = (column, currentSchema) => {
|
|
|
1730
1730
|
const freezeSqlClock = (sql) => sql.replaceAll("clock_timestamp()", `'0.1ms'::interval + now()`);
|
|
1731
1731
|
const applyCompareSql = async (compareSql, adapter) => {
|
|
1732
1732
|
if (compareSql.expressions.length) {
|
|
1733
|
-
const { rows: [results] } = await adapter.arrays("SELECT " + compareSql.expressions.map((x) => `${freezeSqlClock(x.inDb)} = (${x.inCode && freezeSqlClock(x.inCode)})`).join(", "), compareSql.values);
|
|
1733
|
+
const { rows: [results] } = await adapter.arrays("SELECT " + compareSql.expressions.map((x, i) => `${freezeSqlClock(x.inDb)} = (${x.inCode && freezeSqlClock(x.inCode)}) "${i}"`).join(", "), compareSql.values);
|
|
1734
1734
|
for (let i = 0; i < results.length; i++) if (!results[i]) compareSql.expressions[i].change();
|
|
1735
1735
|
}
|
|
1736
1736
|
};
|
|
@@ -2922,7 +2922,7 @@ const getActualItems = async (db, currentSchema, internal, columnTypes) => {
|
|
|
2922
2922
|
domains.set(column.dataType, {
|
|
2923
2923
|
schemaName,
|
|
2924
2924
|
name,
|
|
2925
|
-
column: column.data.as ??
|
|
2925
|
+
column: column.data.as ?? UnknownColumn.instance
|
|
2926
2926
|
});
|
|
2927
2927
|
} else {
|
|
2928
2928
|
const en = column.dataType === "enum" ? column : column instanceof ArrayColumn && column.data.item.dataType === "enum" ? column.data.item : void 0;
|