diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-27 18:33:38 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-27 18:34:47 +0100 |
commit | 00d6a41e46e4c4948b0d5b4cf21433150a57c067 (patch) | |
tree | 8366fe4229c96b85b6f2d5e7c88c2565d43e0a50 /scripts/danger/clean/cleaner.js | |
parent | 178edb20259f90b1c59f40728aaf8073f097f1f5 (diff) | |
download | PeerTube-00d6a41e46e4c4948b0d5b4cf21433150a57c067.tar.gz PeerTube-00d6a41e46e4c4948b0d5b4cf21433150a57c067.tar.zst PeerTube-00d6a41e46e4c4948b0d5b4cf21433150a57c067.zip |
Add script to migrate from mongodb to postgresql
Usage: NODE_ENV=production ./scripts/mongo-to-postgre.js --mongo-database peertube-prod
Diffstat (limited to 'scripts/danger/clean/cleaner.js')
-rw-r--r-- | scripts/danger/clean/cleaner.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/danger/clean/cleaner.js b/scripts/danger/clean/cleaner.js index d1e218145..1a1e3dee7 100644 --- a/scripts/danger/clean/cleaner.js +++ b/scripts/danger/clean/cleaner.js | |||
@@ -1,3 +1,4 @@ | |||
1 | const eachSeries = require('async/eachSeries') | ||
1 | const rimraf = require('rimraf') | 2 | const rimraf = require('rimraf') |
2 | 3 | ||
3 | const constants = require('../../../server/initializers/constants') | 4 | const constants = require('../../../server/initializers/constants') |
@@ -10,14 +11,15 @@ db.init(true, function () { | |||
10 | console.info('Tables of %s deleted.', db.sequelize.config.database) | 11 | console.info('Tables of %s deleted.', db.sequelize.config.database) |
11 | 12 | ||
12 | const STORAGE = constants.CONFIG.STORAGE | 13 | const STORAGE = constants.CONFIG.STORAGE |
13 | Object.keys(STORAGE).forEach(function (storage) { | 14 | eachSeries(Object.keys(STORAGE), function (storage, callbackEach) { |
14 | const storageDir = STORAGE[storage] | 15 | const storageDir = STORAGE[storage] |
15 | 16 | ||
16 | rimraf(storageDir, function (err) { | 17 | rimraf(storageDir, function (err) { |
17 | if (err) throw err | 18 | console.info('%s deleted.', storageDir) |
18 | 19 | return callbackEach(err) | |
19 | console.info('Deleting %s.', storageDir) | ||
20 | }) | 20 | }) |
21 | }, function () { | ||
22 | process.exit(0) | ||
21 | }) | 23 | }) |
22 | }) | 24 | }) |
23 | }) | 25 | }) |