Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: support absolute paths in migrationsDir for the CLI (#6660)
Right now the CLI will ALWAYS prepend the CWD to `options.cli.migrationsDir`. 

This prevents us from using absolute paths there. 

How would we feel about changing that to support absolute paths (by only prepending CLI if the path DOES NOT start with "/")? If we're open to it, I'm happy to make the change for the other CLI commands as well.
  • Loading branch information
tomasreimers committed Sep 3, 2020
1 parent cf3ad62 commit 2b5f139
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/MigrationCreateCommand.ts
Expand Up @@ -59,7 +59,7 @@ export class MigrationCreateCommand implements yargs.CommandModule {
} catch (err) { }
}

const path = process.cwd() + "/" + (directory ? (directory + "/") : "") + filename;
const path = (directory.startsWith("/") ? "" : process.cwd() + "/") + (directory ? (directory + "/") : "") + filename;
await CommandUtils.createFile(path, fileContent);
console.log(`Migration ${chalk.blue(path)} has been generated successfully.`);

Expand Down

0 comments on commit 2b5f139

Please sign in to comment.