1
0
Fork 0
peertube/scripts/danger/clean/cleaner.js

24 lines
623 B
JavaScript
Raw Normal View History

2016-10-13 19:45:23 +00:00
const rimraf = require('rimraf')
const constants = require('../../../server/initializers/constants')
2016-12-25 08:44:13 +00:00
const db = require('../../../server/initializers/database')
2016-10-13 19:45:23 +00:00
2016-12-25 08:44:13 +00:00
db.init(true, function () {
db.sequelize.drop().asCallback(function (err) {
if (err) throw err
2016-10-13 19:45:23 +00:00
2016-12-25 08:44:13 +00:00
console.info('Tables of %s deleted.', db.sequelize.config.database)
2016-10-13 19:45:23 +00:00
2016-12-25 08:44:13 +00:00
const STORAGE = constants.CONFIG.STORAGE
Object.keys(STORAGE).forEach(function (storage) {
const storageDir = STORAGE[storage]
rimraf(storageDir, function (err) {
if (err) throw err
2016-10-13 19:45:23 +00:00
2016-12-25 08:44:13 +00:00
console.info('Deleting %s.', storageDir)
})
})
2016-10-13 19:45:23 +00:00
})
})