Reputation: 3056
I had an idea and before implementing I would like to throw it out there to get some feedback or even discover that somebody has already done.
Here is the thing: I have a website running with a database that is growing quite rapidly and over the months, and over the several issues that took place, got filled with a good amount of garbage. I was thinking in put-up some scripts to run across the database and clean up the mess. So, my idea was to use Django Tests, in a way that one would write a large sum of small simple tests that would do exactly that, except that instead of raising a flag, would actually fix things.
What do you guys think? I can't think in any reason why this wouldn't work. But I'm not that seasoned in Django. Would it be hard? Any foreseeable issue?
Thanks!
Upvotes: 0
Views: 183
Reputation: 16683
No, this is a bad idea for many reasons, starting from the design perspective to implementation issues. Just to mention a few:
But there is a very simple and appropriate solution for what you want to do:
Now, this is for one-time fixes only, but in most cases this is the correct way to do it. You fix the bug that causes the data issue, along with fixing the data.
If you really need the same data altering functionality to run more than once (periodically), then for that you can create a custom management command (or just a simple executable python script) and schedule it to run from cron.
Upvotes: 3