Merge pull request #183 from MetaMask/MigrateOffOldInfrastructure

Move all users to new scalable backend
feature/default_network_editable
Dan Finlay 9 years ago
commit 4270c61f15
  1. 1
      CHANGELOG.md
  2. 11
      app/scripts/lib/migrations.js
  3. 22
      app/scripts/migrations/004.js
  4. 5
      test/unit/migrations-test.js

@ -3,6 +3,7 @@
## Current Master ## Current Master
- Fixed bug where send view would not load correctly the first time it was visited per account. - Fixed bug where send view would not load correctly the first time it was visited per account.
- Migrated all users to new scalable backend.
## 1.8.1 2016-05-10 ## 1.8.1 2016-05-10

@ -1,10 +1,5 @@
var path = require('path')
var fs = require('fs')
var migration2 = require('../migrations/002')
var migration3 = require('../migrations/003')
module.exports = [ module.exports = [
migration2, require('../migrations/002'),
migration3, require('../migrations/003'),
require('../migrations/004'),
] ]

@ -0,0 +1,22 @@
module.exports = {
version: 4,
migrate: function(data) {
try {
if (data.config.provider.type !== 'rpc') return data
switch (data.config.provider.rpcTarget) {
case 'https://testrpc.metamask.io/':
data.config.provider = {
type: 'testnet'
}
break
case 'https://rpc.metamask.io/':
data.config.provider = {
type: 'mainnet'
}
break
}
} catch (_) {}
return data
}
}

@ -5,6 +5,7 @@ var wallet1 = require(path.join('..', 'lib', 'migrations', '001.json'))
var migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002')) var migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002'))
var migration3 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '003')) var migration3 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '003'))
var migration4 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '004'))
describe('wallet1 is migrated successfully', function() { describe('wallet1 is migrated successfully', function() {
@ -23,6 +24,10 @@ describe('wallet1 is migrated successfully', function() {
var secondResult = migration3.migrate(firstResult) var secondResult = migration3.migrate(firstResult)
assert.equal(secondResult.config.provider.rpcTarget, newTestRpc) assert.equal(secondResult.config.provider.rpcTarget, newTestRpc)
var thirdResult = migration4.migrate(secondResult)
assert.equal(secondResult.config.provider.rpcTarget, null)
assert.equal(secondResult.config.provider.type, 'testnet')
done() done()
}) })
}) })

Loading…
Cancel
Save