From f6c219ecc27c58fd88d610c16b07f019c7929904 Mon Sep 17 00:00:00 2001 From: Arjun Satarkar Date: Sun, 30 Jul 2023 21:05:27 +0530 Subject: Make feed id autoincrement This is necessary to avoid a condition where the most recently added feed is deleted, and a new one subsequently added, after the latest id has been fetched from the database for updating but before the new entries are inserted. In this case, without autoincrement, entries from the deleted feed would be associated with the newly added feed. This fix does not include migration from the old DB schema without the change since this project is not stable yet, but I intend to start including such migrations in perhaps the very next release that alters the database schema. --- setup.sql | 4 ++-- static/scripts/auto_refresh.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.sql b/setup.sql index 78587de..d4f01e6 100644 --- a/setup.sql +++ b/setup.sql @@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS tagrss_info(info_key TEXT PRIMARY KEY, value TEXT) ST INSERT OR REPLACE INTO tagrss_info(info_key, value) VALUES - ("version", "0.10.0"); + ("version", "0.11.0"); CREATE TABLE IF NOT EXISTS feed_count( id INTEGER PRIMARY KEY CHECK (id = 0), @@ -23,7 +23,7 @@ VALUES (0, 0); CREATE TABLE IF NOT EXISTS feeds( - id INTEGER PRIMARY KEY, + id INTEGER PRIMARY KEY AUTOINCREMENT, source TEXT UNIQUE, title TEXT ) STRICT; diff --git a/static/scripts/auto_refresh.js b/static/scripts/auto_refresh.js index 48af816..5e7223e 100644 --- a/static/scripts/auto_refresh.js +++ b/static/scripts/auto_refresh.js @@ -1,7 +1,7 @@ (() => { const onFrontPage = () => { const searchParams = new URLSearchParams(window.location.search); - let pageNum = searchParams.get("page_num"); + const pageNum = searchParams.get("page_num"); return (pageNum === "1") || (pageNum === null); }; -- cgit v1.2.3-57-g22cb