rake-db 2.29.1 → 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.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) => {
@@ -5878,6 +5890,9 @@ const rakeDbCliWithAdapter = (inputConfig, args = process.argv.slice(2)) => {
5878
5890
  };
5879
5891
  const setRakeDbCliRunFn = (rakeDbCli) => {
5880
5892
  rakeDbCli.run = (options, inputConfig, args) => {
5893
+ if (!("__rakeDbConfig" in inputConfig)) {
5894
+ incrementIntermediateCaller();
5895
+ }
5881
5896
  const { change, run } = rakeDbCli(inputConfig, args);
5882
5897
  run(options);
5883
5898
  return change;