From 8e6b6805c4bc8493f8108f896ccf4f67dbd0b95d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 14 Nov 2013 09:34:51 -0800 Subject: Use async to run migration commands in series --- migrations/20131110070913-add-settlements.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'migrations/20131110070913-add-settlements.js') diff --git a/migrations/20131110070913-add-settlements.js b/migrations/20131110070913-add-settlements.js index 7c835f87..c66ee863 100644 --- a/migrations/20131110070913-add-settlements.js +++ b/migrations/20131110070913-add-settlements.js @@ -1,17 +1,19 @@ var dbm = require('db-migrate'); +var async = require('async'); var type = dbm.dataType; exports.up = function(db, callback) { - db.createTable('settlements', { + async.series([ + db.createTable.bind(db, 'settlements', { id: { type: 'int', primaryKey: true, autoIncrement: true }, settler_id: { type: 'int' }, merchant_id: { type: 'int' }, amount: { type: 'decimal' }, date: { type: 'datetime' }, method: { type: 'string' } - }, callback); - - db.runSql('ALTER TABLE settlements ALTER COLUMN amount type decimal(10,2);'); + }), + db.runSql.bind(db, 'ALTER TABLE settlements ALTER COLUMN amount type decimal(10,2);') + ], callback); }; exports.down = function(db, callback) { -- cgit v1.2.3