Skip to content

Commit

Permalink
chore(suite): migrate db
Browse files Browse the repository at this point in the history
  • Loading branch information
enjojoy committed Jan 13, 2025
1 parent e480392 commit 7b6fc20
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/suite/src/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { reloadApp } from 'src/utils/suite/reload';
import { migrate } from './migrations';
import type { SuiteDBSchema } from './definitions';

const VERSION = 51; // don't forget to add migration and CHANGELOG when changing versions!
const VERSION = 52; // don't forget to add migration and CHANGELOG when changing versions!

/**
* If the object stores don't already exist then creates them.
Expand Down
20 changes: 20 additions & 0 deletions packages/suite/src/storage/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1176,4 +1176,24 @@ export const migrate: OnUpgradeFunc<SuiteDBSchema> = async (
return account;
});
}

if (oldVersion < 52) {
await updateAll(transaction, 'accounts', account => {
if (
account.networkType === 'ethereum' ||
account.networkType === 'cardano' ||
account.networkType === 'solana' ||
account.networkType === 'ripple'
) {
account.tokens?.forEach(token => {
token.standard = token.type || '';
delete token.type;
});

return account;
}

return account;
});
}
};

0 comments on commit 7b6fc20

Please sign in to comment.