Skip to content

Commit

Permalink
fix: enforce name argument of migration generate command (#2719) (#6690)
Browse files Browse the repository at this point in the history
* fix: enforce name argument of migration generate command

enforce the type of the name argument in order to return a more useful error message when the user forgets to provide a migration name to the generate migration command

Closes: #2719, #4798, #4805

* fix: update error message text for generate migration command when missing name argument

enforce the type of the name argument in order to return a more useful error message when the user forgets to provide a migration name to the generate migration command

Closes: #2719, #4798, #4805

Co-authored-by: Akosua Asante <akosuaasante@gmail.com>
  • Loading branch information
akosasante and Akosua Asante committed Sep 26, 2020
1 parent 180fbd4 commit dfcb2db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/commands/MigrationGenerateCommand.ts
Expand Up @@ -28,7 +28,8 @@ export class MigrationGenerateCommand implements yargs.CommandModule {
.option("n", {
alias: "name",
describe: "Name of the migration class.",
demand: true
demand: true,
type: "string"
})
.option("d", {
alias: "dir",
Expand Down Expand Up @@ -121,7 +122,7 @@ export class MigrationGenerateCommand implements yargs.CommandModule {

console.log(chalk.green(`Migration ${chalk.blue(path)} has been generated successfully.`));
} else {
console.log(chalk.yellow("Please specify migration name"));
console.log(chalk.yellow("Please specify a migration name using the `-n` argument"));
}
} else {
console.log(chalk.yellow(`No changes in database schema were found - cannot generate a migration. To create a new empty migration use "typeorm migration:create" command`));
Expand Down

0 comments on commit dfcb2db

Please sign in to comment.