Skip to content

MySQLDriver findChangedColumns (fields: width, precision) #2737

@alangatti

Description

@alangatti

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:

MySQL version: 5.7
Typescript version: 3.0.1

Everytime schema:sync is called, typeorm drops all fk and re-create them. It also performs alter table change column to timestamp columns. The problem is when findChangedColumns is called.
Line

console.log("width:", tableColumn.width, columnMetadata.width);
console.log("precision:", tableColumn.precision, columnMetadata.precision);

output:

for fk:

width: 10 undefined

for timestamp:

precision: 0 null

Example entity:

@Entity('assignments')
export class Assignment {

  @PrimaryGeneratedColumn({unsigned: true})
  id: number;

  @CreateDateColumn({precision: null, type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'})
  from: Date;

  @Column({precision: null, type: 'timestamp', default: () => null, nullable: true})
  to: Date;

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions