M
M
Michael Pak2014-08-17 18:06:14
Automation
Michael Pak, 2014-08-17 18:06:14

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

2 answer(s)
P
Pavel Solovyov, 2014-08-17
@MichaelPak

create a script with a sql query that will change the status, then add it to cron and run it every minute.

P
plasticmirror, 2014-08-17
@plasticmirror

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 question

Ask a Question

731 491 924 answers to any question