1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

Do not have multiple migration calls completing same callback

This commit is contained in:
ivaosthu 2017-02-22 17:08:16 +01:00
parent fc5abb2952
commit 8c0410c5e8

View File

@ -41,8 +41,10 @@ function removeStrategySQL (strategy) {
exports.up = function (db, callback) {
const insertStrategies = strategies.map((s) => (cb) => {
db.runSql(insertEventsSQL(s), cb);
db.runSql(insertStrategySQL(s), cb);
async.series([
db.runSql.bind(db, insertEventsSQL(s)),
db.runSql.bind(db, insertStrategySQL(s)),
], cb);
});
async.series(insertStrategies, callback);
};
@ -51,8 +53,10 @@ exports.down = function (db, callback) {
const removeStrategies = strategies
.filter(s => s.name !== 'default')
.map((s) => (cb) => {
db.runSql(removeEventsSQL(s), cb);
db.runSql(removeStrategySQL(s), cb);
async.series([
db.runSql.bind(db, removeEventsSQL(s)),
db.runSql.bind(db, removeStrategySQL(s)),
], cb);
});
async.series(removeStrategies, callback);