Server: fix mongo to postgresql script

pull/30/head
Chocobozzz 2017-01-12 17:01:10 +01:00
parent 6c05c149d2
commit acf0ae9c73
1 changed files with 5 additions and 5 deletions

View File

@ -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)
})