There are 2 login and token fields in the table. How to make it so that after the information is recorded in the token field for the specified login, will this field be cleared in a day?

I use MySQL

  • Create a one-time event to reset the desired field of the desired entry. I don’t remember if this is possible from the trigger, if not, then in the trigger just merge all the data into the service table, and with a regular event digest them into the desired event. And if a day is plus or minus sanity, then you can do with a simple sweeper. - Akina

1 answer 1

Actually the question is, is it necessary to fulfill the request on a schedule?

If you think a bit, then most likely the problem can be reformulated as follows:

"It is necessary that the token be valid during the day"

It is solved easier and more standard. A datetime or timestamp type field is added to the table where the time at which the token was created is recorded.

Later on, when checking a token, the time of its creation is also checked. If the token was created during the current day, then the token is considered valid. If it was created earlier, it means that the token is non-working.