Arch: Mark deleted packages as dead and hide them from listings

We've got a lot of packages in the DB that have long been removed from
the Arch repos. These are still indexed, but won't clutter the package
listing anymore.

Also fixed an issue with packages.id numbers getting rather large
because the indexer allocates a new ID for every package on every
update.
This commit is contained in:
Yorhel 2021-12-13 08:18:13 +01:00
parent f3323de5e4
commit b27d55215a
5 changed files with 50 additions and 7 deletions

View file

@ -19,8 +19,15 @@ CREATE TABLE contents (
CREATE TABLE packages (
id SERIAL PRIMARY KEY,
system integer NOT NULL REFERENCES systems(id) ON DELETE CASCADE ON UPDATE CASCADE,
category varchar,
category varchar NOT NULL,
name varchar NOT NULL,
-- Whether this package has been seen in the last repository update. This
-- field is only updated for a few systems that are likely to delete packages
-- over time; non-rolling-release distros tend to not delete packages after
-- all.
-- Packages where the latest version does not have any man pages may also be
-- marked as dead even if the package is still available in the repos.
dead boolean NOT NULL DEFAULT FALSE,
UNIQUE(system, name, category) -- Note the order, lookups on (system,name) are common
);