|
|
@@ -20,7 +20,9 @@ defaultSupportedCommandsNameForSingleUse.forEach((commandName) => {
|
|
|
module.exports = {
|
|
|
async up(db) {
|
|
|
logger.info('Apply migration');
|
|
|
- if (mongoose.connection.readyState === 1) {
|
|
|
+ // connect only if disconnected
|
|
|
+ // see: https://mongoosejs.com/docs/api/connection.html#connection_Connection-readyState
|
|
|
+ if (mongoose.connection.readyState === 0) {
|
|
|
await mongoose.connect(getMongoUri(), mongoOptions);
|
|
|
}
|
|
|
|