Thursday, 5 September 2013

How can I automatically modify a database record after a certain amount of time?

How can I automatically modify a database record after a certain amount of
time?

I am writing a web app with the Django framework, and I have some higher
level questions about how I would automatically modify my data after
certain time periods.
I have two different updates that I want to do:
I want to perform some actions on my database every Monday at 12:01 AM. I
have been thinking I would just run a cron job to do this.
I have a model "Transaction" That has a time created field. 48 hours after
a Transaction is created, I want to switch some Boolean fields in the
Transaction, and make some changes to other related objects.
Is my best bet for #2 just running a cron job every minute, checking if
any transactions are 48+ hours old? Is there an easier way to do both that
I am missing?

No comments:

Post a Comment