diff options
author | Florian Dold <florian@dold.me> | 2021-08-24 15:43:06 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-08-24 15:43:06 +0200 |
commit | 4c41e705658cbae6e4558bf29edeb39f474c244a (patch) | |
tree | 6e598a6fd1ead8972c0b6cf551c3f3cb8293aec0 /packages/taler-wallet-core/src/db-utils.ts | |
parent | a09359bd3930f2a4550de22bd018122a2c7846e6 (diff) | |
download | wallet-core-4c41e705658cbae6e4558bf29edeb39f474c244a.tar.xz |
DB schema cleanup
Diffstat (limited to 'packages/taler-wallet-core/src/db-utils.ts')
-rw-r--r-- | packages/taler-wallet-core/src/db-utils.ts | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/db-utils.ts b/packages/taler-wallet-core/src/db-utils.ts index 424d12b84..849dcfd15 100644 --- a/packages/taler-wallet-core/src/db-utils.ts +++ b/packages/taler-wallet-core/src/db-utils.ts @@ -134,8 +134,27 @@ export async function openTalerDatabase( }); if (currentMainVersion !== TALER_DB_NAME) { - // In the future, the migration logic will be implemented here. - throw Error(`migration from database ${currentMainVersion} not supported`); + switch (currentMainVersion) { + case "taler-wallet-main-v2": { + // We consider this a pre-release + // development version, no migration is done. + await metaDb + .mktx((x) => ({ + metaConfig: x.metaConfig, + })) + .runReadWrite(async (tx) => { + await tx.metaConfig.put({ + key: CURRENT_DB_CONFIG_KEY, + value: TALER_DB_NAME, + }); + }); + break; + } + default: + throw Error( + `migration from database ${currentMainVersion} not supported`, + ); + } } const mainDbHandle = await openDatabase( |