rake-db 2.29.1 → 2.29.3

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 CHANGED
@@ -1743,8 +1743,8 @@ interface ColumnChecks {
1743
1743
  declare const getDbTableColumnsChecks: (tableData: StructureToAstTableData) => ColumnChecks;
1744
1744
  declare const dbColumnToAst: (ctx: StructureToAstCtx, data: IntrospectedStructure, domains: DbStructureDomainsMap, tableName: string, item: DbStructure.Column, table?: DbStructure.Table, tableData?: StructureToAstTableData, checks?: ColumnChecks) => [key: string, column: Column];
1745
1745
 
1746
- declare const writeMigrationFile: (config: Pick<RakeDbConfig, 'migrationsPath' | 'basePath' | 'dbScript' | 'logger'>, version: string, name: string, migrationCode: string) => Promise<void>;
1747
- declare const makeFileVersion: (ctx: RakeDbCtx, config: Pick<RakeDbConfig, 'migrationId' | 'renameMigrations' | 'migrations' | 'basePath' | 'import' | 'migrationsPath'>) => Promise<string>;
1746
+ declare const writeMigrationFile: (config: RakeDbConfig, version: string, name: string, migrationCode: string) => Promise<void>;
1747
+ declare const makeFileVersion: (ctx: RakeDbCtx, config: RakeDbConfig) => Promise<string>;
1748
1748
 
1749
1749
  declare class RakeDbError extends Error {
1750
1750
  }
package/dist/index.js CHANGED
@@ -3110,8 +3110,20 @@ const sortMigrationsAsc = (a, b) => +a.version - +b.version;
3110
3110
  async function getMigrationsFromFiles(config, allowDuplicates, getVersion = getMigrationVersionOrThrow) {
3111
3111
  const { migrationsPath, import: imp } = config;
3112
3112
  const entries = await fs.readdir(migrationsPath, { withFileTypes: true }).catch(
3113
- () => []
3113
+ (err) => ({ err })
3114
3114
  );
3115
+ if ("err" in entries) {
3116
+ if (entries.err.code === "ENOENT") {
3117
+ config.logger?.log(`Directory ${migrationsPath} does not exist`);
3118
+ return { migrations: [] };
3119
+ } else {
3120
+ throw entries.err;
3121
+ }
3122
+ } else if (!entries) {
3123
+ config.logger?.log(
3124
+ `Could not find any migration files in ${migrationsPath}`
3125
+ );
3126
+ }
3115
3127
  const versions = {};
3116
3128
  const result = entries.reduce(
3117
3129
  (data, file) => {
@@ -5880,6 +5892,9 @@ const rakeDbCliWithAdapter = (inputConfig, args = process.argv.slice(2)) => {
5880
5892
  };
5881
5893
  const setRakeDbCliRunFn = (rakeDbCli) => {
5882
5894
  rakeDbCli.run = (options, inputConfig, args) => {
5895
+ if (!("__rakeDbConfig" in inputConfig)) {
5896
+ incrementIntermediateCaller();
5897
+ }
5883
5898
  const { change, run } = rakeDbCli(inputConfig, args);
5884
5899
  run(options);
5885
5900
  return change;