-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Description
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[ ] latest
[ ] @next
[x] 0.2.7 (or put your version here)
Steps to reproduce or a small repository showing the problem:
- Create an entity class which has a column decorated with
@UpdateDateColumn
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
@Entity('sample')
export class Sample {
@PrimaryGeneratedColumn({ name: 'id', unsigned: true })
id?: string;
@Column('varchar', { name: 'name' })
name: string;
@CreateDateColumn({ name: 'created_at', precision: 3 })
readonly createdAt?: Date;
@UpdateDateColumn({ name: 'updated_at', precision: 3 })
readonly updatedAt?: Date;
}
- Create an entity object and insert to the database
- Find the same entity object, modify some columns and update with the save method
- The column with
@UpdateDateColumnis updated withCURRENT_TIMESTAMPwithout precision
I think it would work if it uses MySQL's ON UPDATE like ON UPDATE CURRENT_TIMESTAMP(3).
But the wrong expression is hard coded below.
https://github.com/typeorm/typeorm/blob/master/src/query-builder/UpdateQueryBuilder.ts#L417
Is there any workaround ?
Reactions are currently unavailable