Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(create): use same timestamp in every created file #485

Merged
merged 1 commit into from
Jul 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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