diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-02-16 03:14:53 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2017-02-16 03:14:53 +0800 |
commit | 75f7c1244a43e48d45767e559a3b1b48f068030b (patch) | |
tree | 1f2c13bd9b3f65846e323d1894e22d66e5f40af8 /app/scripts/migrations/004.js | |
parent | cd75d861874f300fdca7b20274d170d0023d6caf (diff) | |
download | tangerine-wallet-browser-75f7c1244a43e48d45767e559a3b1b48f068030b.tar tangerine-wallet-browser-75f7c1244a43e48d45767e559a3b1b48f068030b.tar.gz tangerine-wallet-browser-75f7c1244a43e48d45767e559a3b1b48f068030b.tar.bz2 tangerine-wallet-browser-75f7c1244a43e48d45767e559a3b1b48f068030b.tar.lz tangerine-wallet-browser-75f7c1244a43e48d45767e559a3b1b48f068030b.tar.xz tangerine-wallet-browser-75f7c1244a43e48d45767e559a3b1b48f068030b.tar.zst tangerine-wallet-browser-75f7c1244a43e48d45767e559a3b1b48f068030b.zip |
Made migrations non-destructive; fixed currency migration.
Diffstat (limited to 'app/scripts/migrations/004.js')
-rw-r--r-- | app/scripts/migrations/004.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/app/scripts/migrations/004.js b/app/scripts/migrations/004.js index 0f9850208..405d932f8 100644 --- a/app/scripts/migrations/004.js +++ b/app/scripts/migrations/004.js @@ -1,25 +1,28 @@ const version = 4 +const clone = require('clone') + module.exports = { - version, + version, migrate: function (versionedData) { - versionedData.meta.version = version + let safeVersionedData = clone(versionedData) + safeVersionedData.meta.version = version try { - if (versionedData.data.config.provider.type !== 'rpc') return Promise.resolve(versionedData) - switch (versionedData.data.config.provider.rpcTarget) { + if (safeVersionedData.data.config.provider.type !== 'rpc') return Promise.resolve(safeVersionedData) + switch (safeVersionedData.data.config.provider.rpcTarget) { case 'https://testrpc.metamask.io/': - versionedData.data.config.provider = { + safeVersionedData.data.config.provider = { type: 'testnet', } break case 'https://rpc.metamask.io/': - versionedData.data.config.provider = { + safeVersionedData.data.config.provider = { type: 'mainnet', } break } } catch (_) {} - return Promise.resolve(versionedData) + return Promise.resolve(safeVersionedData) }, } |