Answer the question
In order to leave comments, you need to log in
How to automate change in db over time?
Gentlemen, help me figure it out. I have no idea how to implement this task and what exactly to google. I know about the existence of cron, but I hope there is an easier solution.
The database stores a model with the startDateTime and finishDateTime fields, depending on which, in comparison with the current time, the status field can have three statuses: inactive, active, and expired. It is necessary to automatically change the status field when the current time reaches startDateTime or finishDateTime.
Answer the question
In order to leave comments, you need to log in
create a script with a sql query that will change the status, then add it to cron and run it every minute.
why not pull out the logic of interpretation on the client? why in the database?
if it is in the database - well, in any way, run a scheduled script that will update the database - if you do not need accuracy to seconds
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question