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

Delete old Historical Records #198

Closed
cleder opened this issue Nov 17, 2015 · 6 comments
Closed

Delete old Historical Records #198

cleder opened this issue Nov 17, 2015 · 6 comments

Comments

@cleder
Copy link
Member

cleder commented Nov 17, 2015

To keep the history growing too much I'd like to have a function that deletes all historical records older than x days. So the function can be reused in a management command or a celery task

@robmoorman
Copy link

Also the ability to delete old record via the admin would be nice.

@michael54
Copy link

👍

@macro1
Copy link
Collaborator

macro1 commented Apr 11, 2016

This might go without saying, but doing this with the ORM is pretty easy:

MyModel.history.filter(history_date__lt=timezone.now() - timedelta(days=90)).delete()

That should delete all historical records older than 90 days. You could also filter on history_type if there was a reason to keep deletions around for audit purposes.

@nikechristo
Copy link

If django-simple-history can self-manage by having the ability to delete old history records, that would be very useful.

@rossmechanic
Copy link
Collaborator

Being addressed in #483

@rossmechanic
Copy link
Collaborator

Dupe of #313

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

No branches or pull requests

6 participants