1
0
Fork 0

Server: fix mongo to postgresql script

This commit is contained in:
Chocobozzz 2017-01-12 17:01:10 +01:00
parent 6c05c149d2
commit acf0ae9c73

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