rake-db 2.27.23 → 2.27.25
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/index.d.ts +23 -18
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isRawSQL, escapeForMigration, ArrayColumn, toSnakeCase, toCamelCase, DomainColumn, toArray, EnumColumn, defaultSchemaConfig, snakeCaseKey, getColumnTypes, parseTableData, emptyObject, escapeString, tableDataMethods, setCurrentColumnName, consumeColumnName,
|
|
1
|
+
import { isRawSQL, escapeForMigration, ArrayColumn, toSnakeCase, toCamelCase, DomainColumn, toArray, EnumColumn, defaultSchemaConfig, snakeCaseKey, getColumnTypes, parseTableData, emptyObject, escapeString, tableDataMethods, setCurrentColumnName, consumeColumnName, Column, parseTableDataInput, UnknownColumn, setDefaultLanguage, deepCompare, raw, singleQuote, logParamToLogObject, createDbWithAdapter, getImportPath, pathToLog, emptyArray, makeColumnTypes, getStackTrace, colors, makeColumnsByType, RawSQL, CustomTypeColumn, assignDbDataToColumn, PostgisGeographyPointColumn, exhaustive, codeToString, addCode, quoteObjectKey, pushTableDataCode, primaryKeyInnerToCode, indexInnerToCode, excludeInnerToCode, constraintInnerToCode, referencesArgsToCode, backtickQuote, TimestampTZColumn, TimestampColumn } from 'pqb';
|
|
2
2
|
import path, { join } from 'path';
|
|
3
3
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
4
4
|
import fs, { mkdir, writeFile, readdir, stat, readFile } from 'fs/promises';
|
|
@@ -621,14 +621,14 @@ const addOrDropChanges = [];
|
|
|
621
621
|
function add(item, options) {
|
|
622
622
|
consumeColumnName();
|
|
623
623
|
setName(this, item);
|
|
624
|
-
if (item instanceof
|
|
624
|
+
if (item instanceof Column) {
|
|
625
625
|
const result = addOrDrop("add", item, options);
|
|
626
626
|
if (result.type === "change") return result;
|
|
627
627
|
addOrDropChanges.push(result);
|
|
628
628
|
return addOrDropChanges.length - 1;
|
|
629
629
|
}
|
|
630
630
|
for (const key in item) {
|
|
631
|
-
if (item[key] instanceof
|
|
631
|
+
if (item[key] instanceof Column) {
|
|
632
632
|
const result = {};
|
|
633
633
|
for (const key2 in item) {
|
|
634
634
|
result[key2] = {
|
|
@@ -647,14 +647,14 @@ function add(item, options) {
|
|
|
647
647
|
const drop = function(item, options) {
|
|
648
648
|
consumeColumnName();
|
|
649
649
|
setName(this, item);
|
|
650
|
-
if (item instanceof
|
|
650
|
+
if (item instanceof Column) {
|
|
651
651
|
const result = addOrDrop("drop", item, options);
|
|
652
652
|
if (result.type === "change") return result;
|
|
653
653
|
addOrDropChanges.push(result);
|
|
654
654
|
return addOrDropChanges.length - 1;
|
|
655
655
|
}
|
|
656
656
|
for (const key in item) {
|
|
657
|
-
if (item[key] instanceof
|
|
657
|
+
if (item[key] instanceof Column) {
|
|
658
658
|
const result = {};
|
|
659
659
|
for (const key2 in item) {
|
|
660
660
|
result[key2] = {
|
|
@@ -696,7 +696,7 @@ const addOrDrop = (type, item, options) => {
|
|
|
696
696
|
};
|
|
697
697
|
};
|
|
698
698
|
const columnTypeToColumnChange = (item, name) => {
|
|
699
|
-
if (item instanceof
|
|
699
|
+
if (item instanceof Column) {
|
|
700
700
|
let column = item;
|
|
701
701
|
const foreignKeys = column.data.foreignKeys;
|
|
702
702
|
if (foreignKeys?.some((it) => "fn" in it)) {
|
|
@@ -718,9 +718,9 @@ const setName = (self, item) => {
|
|
|
718
718
|
var _a, _b;
|
|
719
719
|
const name = self[nameKey];
|
|
720
720
|
if (!name) return;
|
|
721
|
-
if ("column" in item && item.column instanceof
|
|
721
|
+
if ("column" in item && item.column instanceof Column) {
|
|
722
722
|
(_a = item.column.data).name ?? (_a.name = name);
|
|
723
|
-
} else if (item instanceof
|
|
723
|
+
} else if (item instanceof Column) {
|
|
724
724
|
(_b = item.data).name ?? (_b.name = name);
|
|
725
725
|
} else {
|
|
726
726
|
item.name ?? (item.name = name);
|
|
@@ -821,7 +821,7 @@ const makeAst$1 = (up, name, changeData, changeTableData2, options) => {
|
|
|
821
821
|
if (typeof item === "number") {
|
|
822
822
|
consumedChanges[item] = true;
|
|
823
823
|
item = addOrDropChanges[item];
|
|
824
|
-
} else if (item instanceof
|
|
824
|
+
} else if (item instanceof Column) {
|
|
825
825
|
item = addOrDrop("add", item);
|
|
826
826
|
}
|
|
827
827
|
if ("type" in item) {
|
|
@@ -3283,7 +3283,7 @@ const ensureMigrationsPath = (config) => {
|
|
|
3283
3283
|
};
|
|
3284
3284
|
const ensureBasePathAndDbScript = (config, intermediateCallers = 0) => {
|
|
3285
3285
|
if (config.basePath && config.dbScript) return config;
|
|
3286
|
-
let filePath = getStackTrace()?.[3 + intermediateCallers]
|
|
3286
|
+
let filePath = getStackTrace()?.[3 + intermediateCallers]?.getFileName();
|
|
3287
3287
|
if (!filePath) {
|
|
3288
3288
|
throw new Error(
|
|
3289
3289
|
"Failed to determine path to db script. Please set basePath option of rakeDb"
|