aboutsummaryrefslogtreecommitdiff
path: root/lib/wallet/db.ts
diff options
context:
space:
mode:
authortg(x) <*@tg-x.net>2016-03-02 16:53:14 +0100
committertg(x) <*@tg-x.net>2016-03-02 16:53:14 +0100
commit51d6f9fd94d05741e733b01be915afeb5572f355 (patch)
tree024ef8cab1db8543574c6be33edf9dc2da0ef6ac /lib/wallet/db.ts
parentcd331e1855fd4c7033e43622ec0a963fefe37bdb (diff)
parent13a8f36cad4d5d2ffec788ff6b4d5b61ed4ddff9 (diff)
Merge branch 'master' of taler.net:/var/git/wallet-webex
Diffstat (limited to 'lib/wallet/db.ts')
-rw-r--r--lib/wallet/db.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/wallet/db.ts b/lib/wallet/db.ts
index c7621c5ff..9374aa447 100644
--- a/lib/wallet/db.ts
+++ b/lib/wallet/db.ts
@@ -25,7 +25,7 @@
*/
const DB_NAME = "taler";
-const DB_VERSION = 1;
+const DB_VERSION = 5;
/**
* Return a promise that resolves
@@ -45,12 +45,13 @@ export function openTalerDb(): Promise<IDBDatabase> {
console.log("DB: upgrade needed: oldVersion = " + e.oldVersion);
switch (e.oldVersion) {
case 0: // DB does not exist yet
- const mints = db.createObjectStore("mints", {keyPath: "baseUrl"});
- mints.createIndex("pubKey", "masterPublicKey");
+ const exchanges = db.createObjectStore("exchanges",
+ {keyPath: "baseUrl"});
+ exchanges.createIndex("pubKey", "masterPublicKey");
db.createObjectStore("reserves", {keyPath: "reserve_pub"});
db.createObjectStore("denoms", {keyPath: "denomPub"});
const coins = db.createObjectStore("coins", {keyPath: "coinPub"});
- coins.createIndex("mintBaseUrl", "mintBaseUrl");
+ coins.createIndex("exchangeBaseUrl", "exchangeBaseUrl");
const transactions = db.createObjectStore("transactions",
{keyPath: "contractHash"});
transactions.createIndex("repurchase",
@@ -68,6 +69,15 @@ export function openTalerDb(): Promise<IDBDatabase> {
});
history.createIndex("timestamp", "timestamp");
break;
+ default:
+ if (e.oldVersion != DB_VERSION) {
+ window.alert("Incompatible wallet dababase version, please reset" +
+ " db.");
+ chrome.browserAction.setBadgeText({text: "R!"});
+ chrome.browserAction.setBadgeBackgroundColor({color: "#F00"});
+ throw Error("incompatible DB");
+ }
+ break;
}
};
});