rake-db 2.29.0 → 2.29.2
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 +3 -3
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -7
- package/dist/index.mjs.map +1 -1
- package/dist/node-postgres.js +5 -3
- package/dist/node-postgres.js.map +1 -1
- package/dist/node-postgres.mjs +5 -3
- package/dist/node-postgres.mjs.map +1 -1
- package/dist/postgres-js.js +5 -3
- package/dist/postgres-js.js.map +1 -1
- package/dist/postgres-js.mjs +5 -3
- package/dist/postgres-js.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3108,8 +3108,20 @@ const sortMigrationsAsc = (a, b) => +a.version - +b.version;
|
|
|
3108
3108
|
async function getMigrationsFromFiles(config, allowDuplicates, getVersion = getMigrationVersionOrThrow) {
|
|
3109
3109
|
const { migrationsPath, import: imp } = config;
|
|
3110
3110
|
const entries = await readdir(migrationsPath, { withFileTypes: true }).catch(
|
|
3111
|
-
() =>
|
|
3111
|
+
(err) => ({ err })
|
|
3112
3112
|
);
|
|
3113
|
+
if ("err" in entries) {
|
|
3114
|
+
if (entries.err.code === "ENOENT") {
|
|
3115
|
+
config.logger?.log(`Directory ${migrationsPath} does not exist`);
|
|
3116
|
+
return { migrations: [] };
|
|
3117
|
+
} else {
|
|
3118
|
+
throw entries.err;
|
|
3119
|
+
}
|
|
3120
|
+
} else if (!entries) {
|
|
3121
|
+
config.logger?.log(
|
|
3122
|
+
`Could not find any migration files in ${migrationsPath}`
|
|
3123
|
+
);
|
|
3124
|
+
}
|
|
3113
3125
|
const versions = {};
|
|
3114
3126
|
const result = entries.reduce(
|
|
3115
3127
|
(data, file) => {
|
|
@@ -3659,8 +3671,8 @@ const createOrDropDatabase = async (action, adapters, config, dontClose) => {
|
|
|
3659
3671
|
}
|
|
3660
3672
|
};
|
|
3661
3673
|
const resetDatabaseCommand = async (adapters, config) => {
|
|
3662
|
-
await createOrDropDatabase("
|
|
3663
|
-
await createOrDropDatabase("
|
|
3674
|
+
await createOrDropDatabase("drop", adapters, config);
|
|
3675
|
+
await createOrDropDatabase("create", adapters, config, true);
|
|
3664
3676
|
for (const adapter of adapters) {
|
|
3665
3677
|
await migrate(adapter, config);
|
|
3666
3678
|
}
|
|
@@ -5876,14 +5888,17 @@ const rakeDbCliWithAdapter = (inputConfig, args = process.argv.slice(2)) => {
|
|
|
5876
5888
|
}
|
|
5877
5889
|
};
|
|
5878
5890
|
};
|
|
5879
|
-
const setRakeDbCliRunFn = (rakeDbCli
|
|
5880
|
-
rakeDbCli.run = (
|
|
5891
|
+
const setRakeDbCliRunFn = (rakeDbCli) => {
|
|
5892
|
+
rakeDbCli.run = (options, inputConfig, args) => {
|
|
5893
|
+
if (!("__rakeDbConfig" in inputConfig)) {
|
|
5894
|
+
incrementIntermediateCaller();
|
|
5895
|
+
}
|
|
5881
5896
|
const { change, run } = rakeDbCli(inputConfig, args);
|
|
5882
|
-
run(
|
|
5897
|
+
run(options);
|
|
5883
5898
|
return change;
|
|
5884
5899
|
};
|
|
5885
5900
|
};
|
|
5886
|
-
setRakeDbCliRunFn(rakeDbCliWithAdapter
|
|
5901
|
+
setRakeDbCliRunFn(rakeDbCliWithAdapter);
|
|
5887
5902
|
const runCommand = async (adapters, config, args) => {
|
|
5888
5903
|
let arg = args[0]?.split(":")[0];
|
|
5889
5904
|
if (rakeDbAliases[arg]) {
|