delete player/tribe history and daily player/tribe stats records that are older than 180 days or when a player hasn't logged in for 14 days after the deletion

This commit is contained in:
Dawid Wysokiński 2020-12-28 13:10:07 +01:00
parent a7be1449fa
commit 88a8db8575

View File

@ -24,7 +24,7 @@ func (h *vacuumServerDBWorker) vacuum() error {
defer tx.Close()
withNonExistentPlayers := h.db.Model(&models.Player{}).Column("id").Where("exists = false and NOW() - deleted_at > '14 days'")
withNonExistentTribes := h.db.Model(&models.Tribe{}).Column("id").Where("exists = false and NOW() - deleted_at > '14 days'")
withNonExistentTribes := h.db.Model(&models.Tribe{}).Column("id").Where("exists = false and NOW() - deleted_at > '1 days'")
_, err = tx.Model(&models.PlayerHistory{}).
With("players", withNonExistentPlayers).