aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-12 17:01:10 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-12 17:35:17 +0100
commitacf0ae9c730c19be6447d1d140e2bc04186b4fe4 (patch)
tree1a3910d02ae1929d8fc5f81982cc92823afd4697 /scripts
parent6c05c149d2c123b5a4428fd49eba997714cd67c9 (diff)
downloadPeerTube-acf0ae9c730c19be6447d1d140e2bc04186b4fe4.tar.gz
PeerTube-acf0ae9c730c19be6447d1d140e2bc04186b4fe4.tar.zst
PeerTube-acf0ae9c730c19be6447d1d140e2bc04186b4fe4.zip
Server: fix mongo to postgresql script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mongo-to-postgre.js10
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 })