@CreateDateColumn does not auto populate upon insertion.
See original GitHub issueIssue type:
[x] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
TypeORM version:
[ ] latest
[ ] @next
[x] 0.2.2
Steps to reproduce or a small repository showing the problem:
Sample entity definition.
export class MyEntity {
@PrimaryGeneratedColumn()
public id: number;
@Column({type: "int"})
public password_reset_id: number;
@Column({type: "varchar"})
public password_hash: string;
@CreateDateColumn()
public created_at: Date;
@UpdateDateColumn()
public updated_at: Date;
@Column({type: "timestamp"})
public deleted_at: Date;
}
It would seem that after updating to version 0.2.2
my created_at
columns are no longer being populated upon record insertion. Has the @CreateDateColumn()
decorator changed in someway? Am I missing something completely obvious?
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
How can I create columns with type Date and type DateTime ...
Moreover, automatic dates for certain events are possible: Creation Date, available via @CreateDateColumn() decorator.
Read more >Decorator reference - typeorm - GitBook
If not specified, then table name is generated from entity class name. ... Special column that is automatically set to the entity's insertion...
Read more >typeorm/typeorm - Gitter
Let's say I want to manually create a new object of the below Photo class. How do I create a new entity that...
Read more >Generated Values - EF Core - Microsoft Learn
On relational databases, a column can be configured with a default value; if a row is inserted without a value for that column, ......
Read more >Adding A Created Date And Modified Date Column To A Table ...
The value of the created date column will be set when the record is ... we'll need to create a trigger on the...
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 FreeTop 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
Top GitHub Comments
you can try
in your entity. This should generate the right migration.
Odd, tried this again. I’m still able to generate the right migration.
which generated this migration
which fills the
createdAt
property with the current timestamp