From f7c28c133607a0d5c1ae767a7fd4f01f3c78d4c4 Mon Sep 17 00:00:00 2001 From: Gonzalo Manrique Date: Sun, 9 Jul 2017 17:36:19 -0300 Subject: [PATCH] fix(create): use same timestamp in every created file --- api.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api.js b/api.js index 373b6a0f..54e9fac0 100644 --- a/api.js +++ b/api.js @@ -648,7 +648,7 @@ function executeCreateMigration(internals, config, callback) { templateType = Migration.TemplateType.DEFAULT_COFFEE; } var migration = new Migration(internals.argv.title + ( - shouldCreateCoffeeFile( internals, config ) ? '.coffee' : '.js'), path, new Date(), + shouldCreateCoffeeFile( internals, config ) ? '.coffee' : '.js'), path, internals.runTimestamp, templateType); index.createMigration(migration, function(err, migration) { if (_assert(err, callback)) { @@ -709,7 +709,7 @@ function createSqlFiles(internals, config, callback) { var templateTypeDefaultSQL = Migration.TemplateType.DEFAULT_SQL; var migrationUpSQL = new Migration(internals.argv.title + '-up.sql', - sqlDir, new Date(), templateTypeDefaultSQL); + sqlDir, internals.runTimestamp, templateTypeDefaultSQL); index.createMigration(migrationUpSQL, function(err, migration) { if (_assert(err, callback)) { @@ -717,7 +717,7 @@ function createSqlFiles(internals, config, callback) { migration.path)); var migrationDownSQL = new Migration(internals.argv.title + - '-down.sql', sqlDir, new Date(), templateTypeDefaultSQL); + '-down.sql', sqlDir, internals.runTimestamp, templateTypeDefaultSQL); index.createMigration(migrationDownSQL, function(err, migration) { if (_assert(err, callback)) { @@ -891,6 +891,8 @@ function run(internals, config) { var action = internals.argv._.shift(), folder = action.split(':'); + internals.runTimestamp = new Date(); + action = folder[0]; switch (action) {