aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjun Satarkar <me@arjunsatarkar.net>2023-07-30 15:35:27 +0000
committerArjun Satarkar <me@arjunsatarkar.net>2023-07-30 15:35:27 +0000
commitf6c219ecc27c58fd88d610c16b07f019c7929904 (patch)
treeb8bcc51f68015e83133cd1e24a10a0e8280a44b1
parent24db878f08b150d2b61d4074374805550785700b (diff)
downloadtagrss-f6c219ecc27c58fd88d610c16b07f019c7929904.tar
tagrss-f6c219ecc27c58fd88d610c16b07f019c7929904.tar.gz
tagrss-f6c219ecc27c58fd88d610c16b07f019c7929904.zip
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.
-rw-r--r--setup.sql4
-rw-r--r--static/scripts/auto_refresh.js2
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);
};