create missing idb store

This commit is contained in:
tophf 2022-05-31 15:32:01 +03:00
parent 30af48a69a
commit 97520be9b2

View File

@ -127,9 +127,11 @@ const db = (() => {
} }
function create(event) { function create(event) {
if (event.oldVersion === 0) { /** @type IDBDatabase */
const idb = event.target.result; const idb = event.target.result;
idb.createObjectStore(getStoreName(idb.name), ID_AS_KEY[idb.name] ? { const sn = getStoreName(idb.name);
if (!idb.objectStoreNames.contains(sn)) {
idb.createObjectStore(sn, ID_AS_KEY[idb.name] ? {
keyPath: 'id', keyPath: 'id',
autoIncrement: true, autoIncrement: true,
} : undefined); } : undefined);