dart-backend / angel

A polished, production-ready backend framework in Dart for the VM, AOT, and Flutter.
https://github.com/dukefirehawk/angel
BSD 3-Clause "New" or "Revised" License
171 stars 22 forks source link

orm: createdAt and updatedAt fields are null by default? #53

Closed outersky closed 1 year ago

outersky commented 2 years ago

Maybe these two fields should be set automatically , or is there a plugin to handle this ?

debuggerx01 commented 2 years ago

Hi, these two fields can be set automatically after this pr: https://github.com/dukefirehawk/angel/pull/22 You can see the link above and check whether the version of angel_orm is 4.0.2 or above, if any questions , please feel free to contact me and provide a simple demo if convenient.

dukefirehawk commented 2 years ago

@outersky Are you still facing this issue?

outersky commented 2 years ago

@outersky Are you still facing this issue?

@dukefirehawk I managed to make it work finally , with an explicit null assignment to that date field, but it seems that the timezone info is lost, and it uses web server's time instead of database server's current_timestamp().

PS: I'm trying to create another simple orm framework for dart : needle_orm_generator

dukefirehawk commented 2 years ago

@outersky Thanks for the feedback. Your ORM project looks great. Will be watching it. One of my goal is to evolve angel3_orm in the direction of Spring data JPA / Hibernate.

outersky commented 2 years ago

@dukefirehawk I make the prototype run finally, all advice is welcome :)

needle_orm_example project

dukefirehawk commented 1 year ago

PostgreSQL driver converts and stores datetime in UTC by default. Column annotation has been expanded to support default value for timestamp field, i.e. @Column(defaultValue: 'now()')