'TypeORM on NestJS @CreateDateColumn gets updated every time the server restarts
This is how my entity looks. Both created and updated fields get overwritten in the database with the current timestamp on all of the records, everytime the server restarts. Of course I am expecting the fields to only update on entity creation and entity update.
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
@Entity('news')
export class News extends BaseEntity {
@PrimaryGeneratedColumn({})
id: number
@Column({type: 'text'})
url: string
@CreateDateColumn()
created: Date;
@UpdateDateColumn()
updated: Date;
}
Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
