]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/request.js
Update migrations code
[github/Chocobozzz/PeerTube.git] / server / models / request.js
index 882f747b76f76eaaa4e984f3f86a87c05f733c26..70aa32610b174d531198320957e4fb09e6396352 100644 (file)
@@ -79,9 +79,11 @@ function deactivate () {
   timer = null
 }
 
-function flush () {
+function flush (callback) {
   removeAll.call(this, function (err) {
     if (err) logger.error('Cannot flush the requests.', { error: err })
+
+    return callback(err)
   })
 }
 
@@ -298,7 +300,7 @@ function listWithLimitAndRandom (limit, callback) {
 
 function removeAll (callback) {
   // Delete all requests
-  this.destroy({ truncate: true }).asCallback(callback)
+  this.truncate({ cascade: true }).asCallback(callback)
 }
 
 function removeWithEmptyTo (callback) {