This is a question on best way to achieve this.
Feature(s) impacted
Is there a way to have a field updatedAt automatically filled in every time a value is changed for a specific row from Forest? Does that already exist?
Observed behavior
I guess a way it would work is by overriding the routes to auto-fill the updatedAt value.
Expected behavior
Ideally, an updatedAt field present in a table would automatically be updated every time a row is updated.
Thank you!
Hello @alexphiev,
What do you mean by:
every time a value is changed for a specific row from Forest?
Can you give me an example just to make sure I understand your need?
Thank you in advance,
Mia
Hi @anon23361380 ,
I think I answered myself and the solution is on the database level directly.
In SQL, I simply need to add that ON UPDATE
statement at the end to have my field automatically set the new update_at
date.
ALTER TABLE t1
ADD COLUMN updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
Thank you anyways,
Alexandre