Before 4 months I tried to know how can I get the last update for a specific table, So I did it using this command
SELECT UPDATE_TIME
FROM information_schema.tables
WHERE TABLE_NAME = 'specific table'
But most of the time the result is null, I don't know why this problem happening.
The type of the tables is InnoDB
.
After that I switched to another solution, I created UPDATE_TIME_OF_TABLES
table and it looks like this
TABLE_NAME | UPDATE_TIME |
---|---|
... | ... |
... | ... |
... | ... |
... | ... |
... | ... |
I created 3 triggers for every table (When insert, update, and delete) that triggers will update the value of the UPDATE_TIME
column this method was working perfectly with me but suddenly I discovered this method does not work with cascaded foreign key as mentioned in this answer so now I should change a lot of code in my project after 4 months because the project was depending on this solution.
What can I do now, What is the third solution?