You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
updated_at and created_at columns which track dates related to entities are sometimes needed. It would be nice to add these columns in a generic fashion, rather than adding a definition to every Table.
A suggestion is to add a property to the Table model that indicates if updated_at and created_at columns should be included automatically.
The updated_at column should automatically update when the row is changed. The implementation and behaviour will vary dependant on the database. In MySQL this is ON UPDATE CURRENT_TIMESTAMP.
The created_at column should be set when the row is inserted.
It may be worth discussing if this should also be part of the ORM.
The text was updated successfully, but these errors were encountered:
@taylorwmitchell Thanks for opening this issue. I have already begun prototyping a solution that is similar to what you describe above. My initial work is being done against PostgreSQL and I have the code in place to handle table creation and invocation of a trigger function on row updates.
These columns will be needed for core ORM functionality which is why I had been working in this area prior to your raising of this issue.
updated_at and created_at columns which track dates related to entities are sometimes needed. It would be nice to add these columns in a generic fashion, rather than adding a definition to every Table.
A suggestion is to add a property to the Table model that indicates if updated_at and created_at columns should be included automatically.
The updated_at column should automatically update when the row is changed. The implementation and behaviour will vary dependant on the database. In MySQL this is
ON UPDATE CURRENT_TIMESTAMP
.The created_at column should be set when the row is inserted.
It may be worth discussing if this should also be part of the ORM.
The text was updated successfully, but these errors were encountered: