aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/taler-wallet-core/src/db.ts48
1 files changed, 24 insertions, 24 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 7e1906351..a23ba0f76 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -118,7 +118,7 @@ export const CURRENT_DB_CONFIG_KEY = "currentMainDbName";
* backwards-compatible way or object stores and indices
* are added.
*/
-export const WALLET_DB_MINOR_VERSION = 4;
+export const WALLET_DB_MINOR_VERSION = 5;
/**
* Ranges for operation status fields.
@@ -2291,7 +2291,7 @@ export const WalletStoresV1 = {
"byExchangeAndContractPriv",
["exchangeBaseUrl", "contractPriv"],
{
- versionAdded: 4,
+ versionAdded: 5,
unique: true,
},
),
@@ -2299,7 +2299,7 @@ export const WalletStoresV1 = {
"byWithdrawalGroupId",
"withdrawalGroupId",
{
- versionAdded: 4,
+ versionAdded: 5,
},
),
byStatus: describeIndex("byStatus", "status"),
@@ -2319,7 +2319,7 @@ export const WalletStoresV1 = {
"byExchangeAndContractPriv",
["exchangeBaseUrl", "contractPriv"],
{
- versionAdded: 4,
+ versionAdded: 5,
unique: true,
},
),
@@ -2337,7 +2337,7 @@ export const WalletStoresV1 = {
"byWithdrawalGroupId",
"withdrawalGroupId",
{
- versionAdded: 4,
+ versionAdded: 5,
},
),
},
@@ -2663,28 +2663,28 @@ function upgradeFromStoreMap(
];
const storeDesc: StoreDescriptor<unknown> = swi.store;
const storeAddedVersion = storeDesc.versionAdded ?? 0;
- if (storeAddedVersion <= oldVersion) {
- continue;
- }
let s: IDBObjectStore;
- // Be tolerant if object store already exists.
- // Probably means somebody deployed without
- // adding the "addedInVersion" attribute.
- if (!upgradeTransaction.objectStoreNames.contains(swi.storeName)) {
- try {
- s = db.createObjectStore(swi.storeName, {
- autoIncrement: storeDesc.autoIncrement,
- keyPath: storeDesc.keyPath,
- });
- } catch (e) {
- const moreInfo = e instanceof Error ? ` Reason: ${e.message}` : "";
- throw Error(
- `Migration failed. Could not create store ${swi.storeName}.${moreInfo}`,
- );
+ if (storeAddedVersion > oldVersion) {
+ // Be tolerant if object store already exists.
+ // Probably means somebody deployed without
+ // adding the "addedInVersion" attribute.
+ if (!upgradeTransaction.objectStoreNames.contains(swi.storeName)) {
+ try {
+ s = db.createObjectStore(swi.storeName, {
+ autoIncrement: storeDesc.autoIncrement,
+ keyPath: storeDesc.keyPath,
+ });
+ } catch (e) {
+ const moreInfo = e instanceof Error ? ` Reason: ${e.message}` : "";
+ throw Error(
+ `Migration failed. Could not create store ${swi.storeName}.${moreInfo}`,
+ );
+ }
}
- } else {
- s = upgradeTransaction.objectStore(swi.storeName);
}
+
+ s = upgradeTransaction.objectStore(swi.storeName);
+
for (const indexName in swi.indexMap as any) {
const indexDesc: IndexDescriptor = swi.indexMap[indexName];
const indexAddedVersion = indexDesc.versionAdded ?? 0;