rake-db 2.10.62 → 2.10.64
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.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var orchidCore = require('orchid-core');
|
|
|
5
5
|
var path = require('path');
|
|
6
6
|
var promises = require('fs/promises');
|
|
7
7
|
var prompts = require('prompts');
|
|
8
|
-
var
|
|
8
|
+
var node_url = require('node:url');
|
|
9
9
|
|
|
10
10
|
var __defProp$7 = Object.defineProperty;
|
|
11
11
|
var __defProps$5 = Object.defineProperties;
|
|
@@ -57,7 +57,7 @@ const migrationConfigDefaults = {
|
|
|
57
57
|
useCodeUpdater: true
|
|
58
58
|
};
|
|
59
59
|
const processRakeDbConfig = (config) => {
|
|
60
|
-
var _a;
|
|
60
|
+
var _a, _b;
|
|
61
61
|
const result = __spreadValues$7(__spreadValues$7({}, migrationConfigDefaults), config);
|
|
62
62
|
if (!result.recurrentPath) {
|
|
63
63
|
result.recurrentPath = path.join(result.migrationsPath, "recurrent");
|
|
@@ -71,12 +71,15 @@ const processRakeDbConfig = (config) => {
|
|
|
71
71
|
delete result.logger;
|
|
72
72
|
}
|
|
73
73
|
if (!result.basePath || !result.dbScript) {
|
|
74
|
-
|
|
74
|
+
let filePath = (_a = orchidCore.getStackTrace()) == null ? void 0 : _a[3].getFileName();
|
|
75
75
|
if (!filePath) {
|
|
76
76
|
throw new Error(
|
|
77
77
|
"Failed to determine path to db script. Please set basePath option of rakeDb"
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
|
+
if (filePath.startsWith("file://")) {
|
|
81
|
+
filePath = node_url.fileURLToPath(filePath);
|
|
82
|
+
}
|
|
80
83
|
const ext = path.extname(filePath);
|
|
81
84
|
if (ext !== ".ts" && ext !== ".js" && ext !== ".mjs") {
|
|
82
85
|
throw new Error(
|
|
@@ -96,7 +99,7 @@ const processRakeDbConfig = (config) => {
|
|
|
96
99
|
result.recurrentPath = path.resolve(result.basePath, result.recurrentPath);
|
|
97
100
|
}
|
|
98
101
|
if ("baseTable" in config) {
|
|
99
|
-
const proto = (
|
|
102
|
+
const proto = (_b = config.baseTable) == null ? void 0 : _b.prototype;
|
|
100
103
|
result.columnTypes = proto.types || pqb.columnTypes;
|
|
101
104
|
if (proto.snakeCase)
|
|
102
105
|
result.snakeCase = true;
|
|
@@ -267,7 +270,7 @@ async function getMigrationsFromFiles(config, up) {
|
|
|
267
270
|
} catch (err) {
|
|
268
271
|
if (err.code !== "ERR_UNSUPPORTED_ESM_URL_SCHEME")
|
|
269
272
|
throw err;
|
|
270
|
-
await imp(
|
|
273
|
+
await imp(node_url.pathToFileURL(filePath).pathname);
|
|
271
274
|
}
|
|
272
275
|
}
|
|
273
276
|
};
|