Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve "clean old history" command to considering the number of entries #1286

Open
rodrigobraga opened this issue Dec 16, 2023 · 1 comment

Comments

@rodrigobraga
Copy link

Problem Statement

I want to keep the history for some models clean based on number of entries.

Describe the solution you'd like

Add an argument to "clean old history" command, to keep just a specified number of entries regardless of age.

Describe alternatives you've considered

Querying history ignoring the latest five (for exemple) entries, then deleting all the rest.

Additional context

Not applicable.

@rodrigobraga
Copy link
Author

rodrigobraga commented Jan 14, 2024

Thinking about this, I have two suggestions, detailed below:

New command

A new command splitting the clean old history between clean by time and clean by counting, avoiding conditionals to deal with both in same command.

Current command maybe can be marked as deprecated and turn into an alias to new command (by time).


New parameter in the current command

Add a new parameter (called "keep" for example) and inside _proccess we can slicing the queryset to ignore entries beyond the limit.


Are they options interesting?

Personally I think the first can more concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant