mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
The cleanup worker now hard-deletes package rows whose deleted_at is older than cache.deleted_retention. The default is 30 days. A value of 0 keeps the rows. The purge runs in bounded batches, with at most 100 batches per cleanup pass, and removes child rows with the package. History tables have no foreign key to packages, and stats_snapshots holds its own counts, so the purge leaves both untouched. The cleanup log line now reports purged_deleted and deleted_retention.
17 lines
361 B
Go
17 lines
361 B
Go
//go:build pgintegration
|
|
|
|
package gormstore
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestPostgresPurgeDeletedPackages(t *testing.T) {
|
|
store, _ := newPostgresStore(t)
|
|
require.NoError(t, store.db.Exec("TRUNCATE packages, stats_snapshots, download_stats_daily RESTART IDENTITY CASCADE").Error)
|
|
|
|
checkPurgeDeletedPackages(t, store)
|
|
}
|