Replies: 1 comment 1 reply
-
I'll improve our docs and mention how you can explicitly specify our model when running the prune command. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just noticed one of my databases was growing. When looking for the cause, I noticed that the healt_check_result_history_items table was already at 31,6 MB, monitoring started on February 1st. And every result since then was present.
I immediately checked my config file, but that was correctly configured (aka
keep_history_for_days' => 5,
).I dived a bit deeper, and noticed that keeping the history (c)lean and mean is done through pruning. But this is not mentioned in the documentation - first I thought I read over it, but then I went looking for it and I also couldn't find it with the search.
I decided to quickly do run the prune command (
php artisan model:prune
) but that resulted to my surprise inno prunable models found
. Hmm. I quickly applied pruning to one of my own models and then this command did work.I did a new try and thereby explicitly mentioning the model to prune, and this worked:
php artisan model:prune --model=Spatie\Health\Models\HealthCheckResultHistoryItem
However, this isn't really a friendly command to ask users to add to their scheduler. So I would propose to add a command to laravel-health (e.g.
health:prune
orhealth:prune-history
) with the recommendation to run add this command to the scheduler to run it daily.If you like this approach, I can make a PR for it. Or am I really talking nonsense/missing something? :-)
Beta Was this translation helpful? Give feedback.
All reactions