From 97520be9b2a5cd5742f464553ef027d5bd3d004b Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 31 May 2022 15:32:01 +0300 Subject: [PATCH] create missing idb store --- background/db.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/background/db.js b/background/db.js index 0d89ead6..230e652e 100644 --- a/background/db.js +++ b/background/db.js @@ -127,9 +127,11 @@ const db = (() => { } function create(event) { - if (event.oldVersion === 0) { - const idb = event.target.result; - idb.createObjectStore(getStoreName(idb.name), ID_AS_KEY[idb.name] ? { + /** @type IDBDatabase */ + const idb = event.target.result; + const sn = getStoreName(idb.name); + if (!idb.objectStoreNames.contains(sn)) { + idb.createObjectStore(sn, ID_AS_KEY[idb.name] ? { keyPath: 'id', autoIncrement: true, } : undefined);