Skip to content

Commit 41628f7

Browse files
authored
Merge pull request #485 from gmanriqueUy/master
fix(create): use same timestamp in every created file
2 parents ecae49b + f7c28c1 commit 41628f7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

api.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ function executeCreateMigration(internals, config, callback) {
648648
templateType = Migration.TemplateType.DEFAULT_COFFEE;
649649
}
650650
var migration = new Migration(internals.argv.title + (
651-
shouldCreateCoffeeFile( internals, config ) ? '.coffee' : '.js'), path, new Date(),
651+
shouldCreateCoffeeFile( internals, config ) ? '.coffee' : '.js'), path, internals.runTimestamp,
652652
templateType);
653653
index.createMigration(migration, function(err, migration) {
654654
if (_assert(err, callback)) {
@@ -709,15 +709,15 @@ function createSqlFiles(internals, config, callback) {
709709

710710
var templateTypeDefaultSQL = Migration.TemplateType.DEFAULT_SQL;
711711
var migrationUpSQL = new Migration(internals.argv.title + '-up.sql',
712-
sqlDir, new Date(), templateTypeDefaultSQL);
712+
sqlDir, internals.runTimestamp, templateTypeDefaultSQL);
713713
index.createMigration(migrationUpSQL, function(err, migration) {
714714
if (_assert(err, callback)) {
715715

716716
log.info(util.format('Created migration up sql file at %s',
717717
migration.path));
718718

719719
var migrationDownSQL = new Migration(internals.argv.title +
720-
'-down.sql', sqlDir, new Date(), templateTypeDefaultSQL);
720+
'-down.sql', sqlDir, internals.runTimestamp, templateTypeDefaultSQL);
721721
index.createMigration(migrationDownSQL, function(err, migration) {
722722
if (_assert(err, callback)) {
723723

@@ -891,6 +891,8 @@ function run(internals, config) {
891891
var action = internals.argv._.shift(),
892892
folder = action.split(':');
893893

894+
internals.runTimestamp = new Date();
895+
894896
action = folder[0];
895897

896898
switch (action) {

0 commit comments

Comments
 (0)