Skip to content

Commit 8ecc478

Browse files
authored
COMPASS-426 (1.5 edition) (#625)
* COMPASS-426: Resave all saved connections * COMPASS-426 bump [email protected] (#622) * COMPASS-426: Fix eslint errors * COMPASS-426: Update comments * COMPASS-426: Change method name
1 parent 5521ccb commit 8ecc478

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
"reflux": "0.4.1",
151151
"reflux-state-mixin": "mongodb-js/reflux-state-mixin",
152152
"semver": "^5.1.0",
153-
"storage-mixin": "^0.8.0",
153+
"storage-mixin": "^0.8.1",
154154
"tunnel-ssh": "^3.2.1-beta",
155155
"turf-destination": "^1.2.1",
156156
"turf-distance": "^1.1.0",

src/app/migrations/1.5.0-beta.5.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const async = require('async');
2+
const debug = require('debug')('mongodb-compass:migrations');
3+
const ConnectionCollection = require('../models/connection-collection');
4+
5+
/**
6+
* This migration removes and then re-saves all connections in order to trigger
7+
* the secureCondition of the "splice" storage backend again, which wasn't correctly
8+
* working in 1.4.1, see COMPASS-426.
9+
*/
10+
function rewriteStoredConnections(done) {
11+
debug('migration: rewriteStoredConnections');
12+
const connections = new ConnectionCollection();
13+
connections.once('sync', function() {
14+
connections.each(function(connection) {
15+
// We destroy the connection and resave it to persist to the correct engine.
16+
if (connection) {
17+
connection.destroy();
18+
connection.save();
19+
}
20+
});
21+
done();
22+
});
23+
connections.fetch({ reset: true });
24+
}
25+
26+
module.exports = function(previousVersion, currentVersion, callback) {
27+
async.series([
28+
rewriteStoredConnections
29+
], function(err) {
30+
if (err) {
31+
return callback(err);
32+
}
33+
callback(null, 'successful migration to remove plaintext passwords');
34+
});
35+
};

src/app/migrations/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ var migrations = {
88
'1.2.0': require('./1.2.0'),
99
'1.3.0-beta.0': require('./1.3.0-beta.0'),
1010
'1.3.0-beta.1': require('./1.3.0-beta.1'),
11-
'1.3.0-beta.3': require('./1.3.0-beta.3')
11+
'1.3.0-beta.3': require('./1.3.0-beta.3'),
12+
'1.5.0-beta.5': require('./1.5.0-beta.5')
1213
};
1314

1415
var migrate = require('app-migrations')(migrations);

0 commit comments

Comments
 (0)