Custom precision on CreateDateColumn and UpdateDateColumn
See original GitHub issueMySQL 5.6 and later releases provide support for fractional timestamps via the DATETIME(1) to DATETIME(6) column types. It would be nice for TypeORM to support them on CreateDateColumn and UpdateDateColumn decorators:
@CreateDateColumn('datetime(6)') // does not work because default has to be CURRENT_TIMESTAMP(6) instead of CURRENT_TIMESTAMP
createdAt: Date;
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Developers - Custom precision on CreateDateColumn and ...
Custom precision on CreateDateColumn and UpdateDateColumn. ... TypeORM to support them on CreateDateColumn and UpdateDateColumn decorators:
Read more >TypeORM Timestamp Date equality not working - Stack Overflow
I recently ran into the same problem and fixed it by adding precision: 3 to the column decorator. Please note that this is...
Read more >Decorator reference - typeorm - GitBook
precision : number - The precision for a decimal (exact numeric) column (applies only for ... @PrimaryColumn() supports custom primary key constraint name:....
Read more >typeorm/typeorm - Gitter
I want to invalidate the precision of "datetime (6)" of @CreateDateColumn. ... createdAt: Date; @UpdateDateColumn({name: 'updated_at', precision: 0, ...
Read more >PostgreSQL and typeorm - Advanced Querying
This is to ensure that the seconds precision stored in postgres ... @UpdateDateColumn() updatedDate: Date // typeorm will use this to do ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi Alex while your soultion fixed the problem for
CreateDateColumn,UpdateDateColumnstill suffers from the same problem.I have used it like so:
@UpdateDateColumn({ precision: null, type: "timestamp", default: () => "CURRENT_TIMESTAMP" }) createdAt: Date;Am I missing something or this is still an issue? Thanks
in latest
@nextyou are able to do following:To make this functionality to work on old mysql versions.