]>
Commit | Line | Data |
---|---|---|
82221ac9 C |
1 | const rimraf = require('rimraf') |
2 | const mongoose = require('mongoose') | |
3 | ||
4 | const constants = require('../../../server/initializers/constants') | |
5 | ||
6 | const mongodbUrl = 'mongodb://' + constants.CONFIG.DATABASE.HOST + ':' + constants.CONFIG.DATABASE.PORT + '/' + constants.CONFIG.DATABASE.DBNAME | |
7 | mongoose.connect(mongodbUrl, function () { | |
8 | console.info('Deleting MongoDB %s database.', constants.CONFIG.DATABASE.DBNAME) | |
9 | mongoose.connection.db.dropDatabase(function () { | |
10 | mongoose.connection.close() | |
11 | }) | |
12 | }) | |
13 | ||
14 | const STORAGE = constants.CONFIG.STORAGE | |
15 | Object.keys(STORAGE).forEach(function (storage) { | |
16 | const storageDir = STORAGE[storage] | |
17 | ||
18 | rimraf(storageDir, function (err) { | |
19 | if (err) throw err | |
20 | ||
21 | console.info('Deleting %s.', storageDir) | |
22 | }) | |
23 | }) |