From ceee4396d31da1a7dde53cb50689f53659c8a4b1 Mon Sep 17 00:00:00 2001 From: Serge K Lebedev Date: Sat, 26 Mar 2022 21:05:49 +0600 Subject: [PATCH] fix: missing timestamp in created migrations filenames (#8802) --- src/commands/MigrationCreateCommand.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/MigrationCreateCommand.ts b/src/commands/MigrationCreateCommand.ts index 19797610fd..b24b42f795 100644 --- a/src/commands/MigrationCreateCommand.ts +++ b/src/commands/MigrationCreateCommand.ts @@ -32,10 +32,12 @@ export class MigrationCreateCommand implements yargs.CommandModule { async handler(args: yargs.Arguments) { try { const timestamp = CommandUtils.getTimestamp(args.timestamp) - const fullPath = (args.path as string).startsWith("/") + const inputPath = (args.path as string).startsWith("/") ? (args.path as string) : path.resolve(process.cwd(), args.path as string) - const filename = path.basename(fullPath) + const filename = path.basename(inputPath) + const fullPath = + path.dirname(inputPath) + "/" + timestamp + "-" + filename const fileContent = args.outputJs ? MigrationCreateCommand.getJavascriptTemplate(