Drops the created columns on users, subscriptions and sessions, which were written by every insert and read by nothing, and migrate()'s add list, whose columns all predate 0.3.0. Removes Db::subscribed_feed_ids (no callers), Db::subscriber_count (one caller wanting > 0) and Managed.orphaned (never read). The old-database test now builds the tables with foreign keys on. Popular now lists the feeds inside an OPML or a Patreon creator, never the collection, as Directory does. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TAC7sLVqfKmY6rsTLXzNgk
1.4 KiB
1.4 KiB
To do
Trim the state database
From an audit of the database layer and a read-only copy of production on 2026-09-12. The data
itself was clean: no leftover tables or indexes, 47 free pages, one stray entry_state row.
Check each against the code before cutting it.
migrate()'s add list. All eight columns arrived in 0.2.0, and 0.5.0 only supports upgrades from 0.3.0 on. Drop the list and its loop; keep theretireddrop loop, which a database coming from 0.4.0 still needs. (src/db.rs)Db::subscribed_feed_ids. No callers; its doc says the scanner walks it, and it does not. (src/db.rs)Db::subscriber_count. One caller, which only asks whether it is above zero:subscriber_counts()?.contains_key(&id). (src/db.rs,src/web.rs)- The
createdcolumns onusers,subscriptionsandsessions. Written on every insert, never read. Add them toretiredand drop them from the inserts. (src/db.rs) Managed.orphaned. Selected bymanaged_feeds()on every call and never read;FeedSummary.orphanedis what the UI uses. (src/db.rs)
Popular
- Popular lists feeds the way Directory does: the feeds inside an OPML or a Patreon
creator, never the collection itself. (
src/web.rs,web/index.html)
After these: cargo test, node tests/page-smoke.js, npx playwright test. Copy state.db
aside before deploying: migrate() drops columns on the first start.