diff options
Diffstat (limited to 'scripts/mongo-to-postgre.js')
-rwxr-xr-x | scripts/mongo-to-postgre.js | 10 |
1 files 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) { | |||
126 | 126 | ||
127 | dbSequelize.Pod.findOrCreate(query).asCallback(function (err, result) { | 127 | dbSequelize.Pod.findOrCreate(query).asCallback(function (err, result) { |
128 | // [ instance, wasCreated ] | 128 | // [ instance, wasCreated ] |
129 | return callback(err, t, result[0]) | 129 | const res = result ? result[0] : null |
130 | return callback(err, t, res) | ||
130 | }) | 131 | }) |
131 | }, | 132 | }, |
132 | 133 | ||
@@ -148,7 +149,8 @@ function migrateVideos (videoMongo, dbSequelize, finalCallback) { | |||
148 | 149 | ||
149 | dbSequelize.Author.findOrCreate(query).asCallback(function (err, result) { | 150 | dbSequelize.Author.findOrCreate(query).asCallback(function (err, result) { |
150 | // [ instance, wasCreated ] | 151 | // [ instance, wasCreated ] |
151 | return callback(err, t, result[0]) | 152 | const res = result ? result[0] : null |
153 | return callback(err, t, res) | ||
152 | }) | 154 | }) |
153 | }, | 155 | }, |
154 | 156 | ||
@@ -235,9 +237,7 @@ function migrateVideos (videoMongo, dbSequelize, finalCallback) { | |||
235 | } | 237 | } |
236 | 238 | ||
237 | // Commit transaction | 239 | // Commit transaction |
238 | t.commit() | 240 | return t.commit().asCallback(callbackEach) |
239 | |||
240 | return callbackEach() | ||
241 | }) | 241 | }) |
242 | }, finalCallback) | 242 | }, finalCallback) |
243 | }) | 243 | }) |