mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-11 18:46:07 +00:00
- Implemented automatic pruning of stale packages across all platform sync endpoints (Arch, AUR, Debian, Ubuntu, Fedora, Homebrew, Winget) - Added `last_seen_at` tracking to mark packages as seen during sync runs and identify inactive packages - Introduced `PRUNE_GRACE_DAYS` and `PRUNE_HARD_DELETE_DAYS` environment variables for configurable soft-delete and hard-delete thresholds
11 lines
444 B
SQL
11 lines
444 B
SQL
-- Add last_seen_at to track soft-deletion by sync scope
|
|
ALTER TABLE packages
|
|
ADD COLUMN IF NOT EXISTS last_seen_at TIMESTAMPTZ;
|
|
|
|
-- Backfill existing rows so they are not immediately purged until their next scoped sync
|
|
UPDATE packages SET last_seen_at = NOW() WHERE last_seen_at IS NULL;
|
|
|
|
-- Helpful index for prune queries
|
|
CREATE INDEX IF NOT EXISTS idx_packages_seen_scope
|
|
ON packages (platform_id, repository, is_active, last_seen_at);
|