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