Skip to content

Commit

Permalink
Merge pull request #485 from gmanriqueUy/master
Browse files Browse the repository at this point in the history
fix(create): use same timestamp in every created file
  • Loading branch information
wzrdtales authored Jul 12, 2017
2 parents ecae49b + f7c28c1 commit 41628f7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -709,15 +709,15 @@ 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)) {

log.info(util.format('Created migration up sql file at %s',
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)) {

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 41628f7

Please sign in to comment.