mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-11 18:46:07 +00:00
feat: add package pruning system with configurable grace periods
- 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
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
-- 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);
|
||||
Reference in New Issue
Block a user