From 2a9f8ed0dc755a0a900938524fbd6f7deb8aac31 Mon Sep 17 00:00:00 2001 From: buvta <12312540+buvta@users.noreply.github.com> Date: Fri, 18 Dec 2020 16:25:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8D=E6=94=B9=E5=8A=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E6=97=B6=E9=87=8D=E7=BD=AE=E8=BD=AF=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/dexie/dexie.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/dexie/dexie.js b/src/lib/dexie/dexie.js index a49e912..41b7ab0 100644 --- a/src/lib/dexie/dexie.js +++ b/src/lib/dexie/dexie.js @@ -16,8 +16,18 @@ db.version(4).stores({ channelList: '++id, name, prefer, channels, group, isActive' }) +// 参考https://github.com/dfahlander/Dexie.js/releases/tag/v3.0.0-alpha.3 upgrade可以改变主键和表名了 +// https://dexie.org/docs/Version/Version.stores() +// https://dexie.org/docs/Version/Version.upgrade() +// https://ahuigo.github.io/b/ria/js-indexedDB#/ 比较旧,适当参考 db.version(5).stores({ + shortcut: null +}) + +db.version(6).stores({ shortcut: '++id, name, key, desc' +}).upgrade(async tx => { + await tx.shortcut.bulkAdd(localKey) }) db.on('populate', () => {