]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - scripts/danger/clean/cleaner.js
d1e2181452d23bae25e515446a38a7c83f95d941
[github/Chocobozzz/PeerTube.git] / scripts / danger / clean / cleaner.js
1 const rimraf = require('rimraf')
2
3 const constants = require('../../../server/initializers/constants')
4 const db = require('../../../server/initializers/database')
5
6 db.init(true, function () {
7 db.sequelize.drop().asCallback(function (err) {
8 if (err) throw err
9
10 console.info('Tables of %s deleted.', db.sequelize.config.database)
11
12 const STORAGE = constants.CONFIG.STORAGE
13 Object.keys(STORAGE).forEach(function (storage) {
14 const storageDir = STORAGE[storage]
15
16 rimraf(storageDir, function (err) {
17 if (err) throw err
18
19 console.info('Deleting %s.', storageDir)
20 })
21 })
22 })
23 })