From acf0ae9c730c19be6447d1d140e2bc04186b4fe4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 12 Jan 2017 17:01:10 +0100 Subject: [PATCH] Server: fix mongo to postgresql script --- scripts/mongo-to-postgre.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/mongo-to-postgre.js b/scripts/mongo-to-postgre.js index 4a581b46a..6cd1ef3b4 100755 --- a/scripts/mongo-to-postgre.js +++ b/scripts/mongo-to-postgre.js @@ -126,7 +126,8 @@ function migrateVideos (videoMongo, dbSequelize, finalCallback) { dbSequelize.Pod.findOrCreate(query).asCallback(function (err, result) { // [ instance, wasCreated ] - return callback(err, t, result[0]) + const res = result ? result[0] : null + return callback(err, t, res) }) }, @@ -148,7 +149,8 @@ function migrateVideos (videoMongo, dbSequelize, finalCallback) { dbSequelize.Author.findOrCreate(query).asCallback(function (err, result) { // [ instance, wasCreated ] - return callback(err, t, result[0]) + const res = result ? result[0] : null + return callback(err, t, res) }) }, @@ -235,9 +237,7 @@ function migrateVideos (videoMongo, dbSequelize, finalCallback) { } // Commit transaction - t.commit() - - return callbackEach() + return t.commit().asCallback(callbackEach) }) }, finalCallback) }) -- 2.25.1