From 8532b5e22d8e31b8cbf00a239ba609757b0ecc98 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 8 Jan 2023 16:22:28 +0100 Subject: [PATCH] Always create the watch history store on db upgrade --- public/efy | 1 + src/App.vue | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) create mode 160000 public/efy diff --git a/public/efy b/public/efy new file mode 160000 index 00000000..64c903b6 --- /dev/null +++ b/public/efy @@ -0,0 +1 @@ +Subproject commit 64c903b6bf21ed8c3f6259f7b8e02266968b91db diff --git a/src/App.vue b/src/App.vue index dd0f8faf..ae6805db 100644 --- a/src/App.vue +++ b/src/App.vue @@ -46,16 +46,14 @@ export default { request.onupgradeneeded = ev => { const db = request.result; console.log("Upgrading object store."); - if (this.getPreferenceBoolean("watchHistory", false)) { - if (!db.objectStoreNames.contains("watch_history")) { - const store = db.createObjectStore("watch_history", { keyPath: "videoId" }); - store.createIndex("video_id_idx", "videoId", { unique: true }); - store.createIndex("id_idx", "id", { unique: true, autoIncrement: true }); - } - if (ev.oldVersion < 2) { - const store = request.transaction.objectStore("watch_history"); - store.createIndex("watchedAt", "watchedAt", { unique: false }); - } + if (!db.objectStoreNames.contains("watch_history")) { + const store = db.createObjectStore("watch_history", { keyPath: "videoId" }); + store.createIndex("video_id_idx", "videoId", { unique: true }); + store.createIndex("id_idx", "id", { unique: true, autoIncrement: true }); + } + if (ev.oldVersion < 2) { + const store = request.transaction.objectStore("watch_history"); + store.createIndex("watchedAt", "watchedAt", { unique: false }); } if (!db.objectStoreNames.contains("playlist_bookmarks")) { const store = db.createObjectStore("playlist_bookmarks", { keyPath: "playlistId" });