Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic created_at and updated_at for Table #189

Open
taylorwmitchell opened this issue Jul 18, 2019 · 1 comment
Open

Generic created_at and updated_at for Table #189

taylorwmitchell opened this issue Jul 18, 2019 · 1 comment
Assignees

Comments

@taylorwmitchell
Copy link

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.

@kilnerm
Copy link
Contributor

kilnerm commented Jul 18, 2019

@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.

@kilnerm kilnerm self-assigned this Jul 18, 2019
@kilnerm kilnerm added this to the 2019.15 milestone Jul 18, 2019
@djones6 djones6 modified the milestones: 2019.15, 2019.17 Aug 5, 2019
@djones6 djones6 modified the milestones: 2019.17, 2019.18 Aug 28, 2019
@djones6 djones6 modified the milestones: 2019.18, 2019.19 Sep 11, 2019
@djones6 djones6 removed this from the 2019.19 milestone Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants