Server: fix db clean for clean script
This commit is contained in:
parent
a4254ea173
commit
7fc4cc8881
1 changed files with 2 additions and 1 deletions
|
@ -1,12 +1,13 @@
|
||||||
const rimraf = require('rimraf')
|
const rimraf = require('rimraf')
|
||||||
const mongoose = require('mongoose')
|
const mongoose = require('mongoose')
|
||||||
|
mongoose.Promise = global.Promise
|
||||||
|
|
||||||
const constants = require('../../../server/initializers/constants')
|
const constants = require('../../../server/initializers/constants')
|
||||||
|
|
||||||
const mongodbUrl = 'mongodb://' + constants.CONFIG.DATABASE.HOST + ':' + constants.CONFIG.DATABASE.PORT + '/' + constants.CONFIG.DATABASE.DBNAME
|
const mongodbUrl = 'mongodb://' + constants.CONFIG.DATABASE.HOST + ':' + constants.CONFIG.DATABASE.PORT + '/' + constants.CONFIG.DATABASE.DBNAME
|
||||||
mongoose.connect(mongodbUrl, function () {
|
mongoose.connect(mongodbUrl, function () {
|
||||||
console.info('Deleting MongoDB %s database.', constants.CONFIG.DATABASE.DBNAME)
|
console.info('Deleting MongoDB %s database.', constants.CONFIG.DATABASE.DBNAME)
|
||||||
mongoose.connection.db.dropDatabase(function () {
|
mongoose.connection.dropDatabase(function () {
|
||||||
mongoose.connection.close()
|
mongoose.connection.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue