From dfcb2db216d6ed33946dfa190e19eb14c0fed390 Mon Sep 17 00:00:00 2001 From: Akosua Date: Sat, 26 Sep 2020 03:57:13 -0400 Subject: [PATCH] fix: enforce name argument of migration generate command (#2719) (#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: #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 --- src/commands/MigrationGenerateCommand.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/MigrationGenerateCommand.ts b/src/commands/MigrationGenerateCommand.ts index a17005ca2d..cdb098c299 100644 --- a/src/commands/MigrationGenerateCommand.ts +++ b/src/commands/MigrationGenerateCommand.ts @@ -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", @@ -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`));