blob: e1c5c8f854e71eb80461566ce0a8d5f2383c0535 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import { Stores } from "./types/dbTypes";
import { openDatabase, Database } from "./util/query";
const TALER_DB_NAME = "taler";
/**
* Current database version, should be incremented
* each time we do incompatible schema changes on the database.
* In the future we might consider adding migration functions for
* each version increment.
*/
export const WALLET_DB_VERSION = 28;
/**
* Return a promise that resolves
* to the taler wallet db.
*/
export function openTalerDatabase(
idbFactory: IDBFactory,
onVersionChange: () => void,
onUpgradeUnsupported: (oldVersion: number, newVersion: number) => void,
): Promise<IDBDatabase> {
return openDatabase(
idbFactory,
TALER_DB_NAME,
WALLET_DB_VERSION,
Stores,
onVersionChange,
onUpgradeUnsupported,
);
}
export function deleteTalerDatabase(idbFactory: IDBFactory) {
Database.deleteDatabase(idbFactory, TALER_DB_NAME);
}
|