Skip to content

Commit

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

* 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: typeorm#2719, typeorm#4798, typeorm#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: typeorm#2719, typeorm#4798, typeorm#4805

Co-authored-by: Akosua Asante <akosuaasante@gmail.com>
  • Loading branch information
2 people authored and Svetlozar committed Jan 12, 2021
1 parent ea22a83 commit 526a21a
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 526a21a

Please sign in to comment.