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
Custom precision on CreateDateColumn and UpdateDateColumn #609
Comments
as of |
This breaks support for MySql 5.5 when creating a table since this version does not support specifying precision for DateTime or Timestamp types. |
the same problem for mysql 5.5 |
@pleerock Reopen this issue and fix for MySQL 5.5. |
in latest @CreateDateColumn({ precision: 4 /* or any other */, default: () => "CURRENT_TIMESTAMP" }) To make this functionality to work on old mysql versions. |
@pleerock This issue was reopened because the addition of precision caused MySQL 5.5 to fail when creating a table. Since this has now been closed twice, perhaps someone should open a new issue for the MySQL 5.5 compatibility problem. @ruimgoncalves or @daggett206 Would either of you like to open a new issue for the MySQL 5.5 precision problem? |
@svicalifornia I wrote a fix for Mysql 5.5. above (set custom default and precision) |
@pleerock Sorry, I'm trying to understand how you have resolved the MySQL 5.5 issue raised by @ruimgoncalves or @daggett206 above. Last July, you said that the new default for CreateDateColumn and UpdateDateColumn was changed to
If you have fixed this, does that mean that you changed the default from |
@svicalifornia in 5.7 we create @CreateDateColumn({ precision: null, type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
createDate: Date; |
Hi Alex I have used it like so: Am I missing something or this is still an issue? |
I am on mariadb 10.4.11, am only able to use the query builder directly to get this column working. I am unable to just say something like
as I will get an error like this:
entity:
tried the above workarounds as well. but if I do this:
it is working. on the latest version of type orm. |
How can I set precision null nowadays with EntitySchema? The field currently is accepting only number and undefined, not null. I can do Also, the updatedAt field with |
MySQL 5.6 and later releases provide support for fractional timestamps via the
DATETIME(1)
toDATETIME(6)
column types. It would be nice for TypeORM to support them on CreateDateColumn and UpdateDateColumn decorators:The text was updated successfully, but these errors were encountered: