summaryrefslogtreecommitdiff
path: root/packages/idb-bridge/src/MemoryBackend.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-02-16 14:49:38 +0100
committerFlorian Dold <florian@dold.me>2021-02-16 14:49:38 +0100
commit4d663d2e595b64e6bf1979eccc701d0f3d55d797 (patch)
tree9c125da5b84a928e4da7e2b98886878f49a23563 /packages/idb-bridge/src/MemoryBackend.ts
parent987f22de02648485ec6f1d3c1558abcfa6d624a0 (diff)
downloadwallet-core-4d663d2e595b64e6bf1979eccc701d0f3d55d797.tar.gz
wallet-core-4d663d2e595b64e6bf1979eccc701d0f3d55d797.tar.bz2
wallet-core-4d663d2e595b64e6bf1979eccc701d0f3d55d797.zip
synchronous schema rollback
Diffstat (limited to 'packages/idb-bridge/src/MemoryBackend.ts')
-rw-r--r--packages/idb-bridge/src/MemoryBackend.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/idb-bridge/src/MemoryBackend.ts b/packages/idb-bridge/src/MemoryBackend.ts
index 7107756a0..4fdcf257c 100644
--- a/packages/idb-bridge/src/MemoryBackend.ts
+++ b/packages/idb-bridge/src/MemoryBackend.ts
@@ -579,9 +579,33 @@ export class MemoryBackend implements Backend {
if (!db) {
throw Error("db not found");
}
+ return db.committedSchema;
+ }
+
+ getCurrentTransactionSchema(btx: DatabaseTransaction): Schema {
+ const myConn = this.connectionsByTransaction[btx.transactionCookie];
+ if (!myConn) {
+ throw Error("unknown connection");
+ }
+ const db = this.databases[myConn.dbName];
+ if (!db) {
+ throw Error("db not found");
+ }
return myConn.modifiedSchema;
}
+ getInitialTransactionSchema(btx: DatabaseTransaction): Schema {
+ const myConn = this.connectionsByTransaction[btx.transactionCookie];
+ if (!myConn) {
+ throw Error("unknown connection");
+ }
+ const db = this.databases[myConn.dbName];
+ if (!db) {
+ throw Error("db not found");
+ }
+ return db.committedSchema;
+ }
+
renameIndex(
btx: DatabaseTransaction,
objectStoreName: string,