From 18eef3927576268602f4539da729d5218e073b46 Mon Sep 17 00:00:00 2001 From: Filipe Medeiros Date: Sat, 27 Nov 2021 18:40:37 +0000 Subject: [PATCH] fix: idb out of line keys --- lib/db/index.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/db/index.ts b/lib/db/index.ts index 0765fb4..e9e349d 100644 --- a/lib/db/index.ts +++ b/lib/db/index.ts @@ -41,10 +41,22 @@ export const openDb = async (version = 1) => { else { dbConnection = await openDB('Database', version, { upgrade: db => { - db.createObjectStore('accounts').createIndex('address', 'address') - db.createObjectStore('cryptoAssets') - db.createObjectStore('encryptedSeed') - db.createObjectStore('preferences') + db.createObjectStore('accounts', { + keyPath: 'index', + autoIncrement: true, + }).createIndex('address', 'address') + db.createObjectStore('cryptoAssets', { + keyPath: 'id', + autoIncrement: true, + }) + db.createObjectStore('encryptedSeed', { + keyPath: 'id', + autoIncrement: true, + }) + db.createObjectStore('preferences', { + keyPath: 'id', + autoIncrement: true, + }) }, }) }