Skip to content

Commit cd128e2

Browse files
author
Anson Tsao
committed
Fix: Ensure scoped migration created in subdirectory
db-migrate create someScope/aMigration --sql-file, the following is created: ./migrations/someScope/xxx-someScope.js ./migrations/sqls/xxx-someScope-up.sql ./migrations/sqls/xxx-someScope-down.sql Instead, I expect: ./migrations/someScope/xxx-aMigration.js ./migrations/someScope/sqls/xxx-aMigration-up.sql ./migrations/someScope/sqls/xxx-aMigration-down.sql Signed-off-by: Anson Tsao <[email protected]>
1 parent bd165a5 commit cd128e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/commands/create-migration.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async function executeCreateMigration (internals, config) {
5151
internals.argv.title = internals.argv._.shift();
5252
folder = internals.argv.title.split('/');
5353

54-
internals.argv.title = folder[folder.length - 2] || folder[0];
54+
internals.argv.title = folder[folder.length - 1] || folder[0];
5555
path = migrationsDir;
5656

5757
if (folder.length > 1) {
@@ -61,6 +61,7 @@ async function executeCreateMigration (internals, config) {
6161
path += folder[i] + '/';
6262
}
6363
}
64+
internals.argv['migrations-dir'] = path
6465

6566
let templateType = Migration.TemplateType.DEFAULT_JS;
6667
if (

0 commit comments

Comments
 (0)