aboutsummaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/action.go b/models/action.go
index 2a84133bf8..f6170005c7 100644
--- a/models/action.go
+++ b/models/action.go
@@ -395,3 +395,13 @@ func activityQueryCondition(opts GetFeedsOptions) (builder.Cond, error) {
return cond, nil
}
+
+// DeleteOldActions deletes all old actions from database.
+func DeleteOldActions(olderThan time.Duration) (err error) {
+ if olderThan <= 0 {
+ return nil
+ }
+
+ _, err = x.Where("created_unix < ?", time.Now().Add(-olderThan).Unix()).Delete(&Action{})
+ return
+}