i use nestjs/typeorm version 8, mysql version 8.
I've tried to insert bigint type data, which is Auto Generated primary key.
Insertion was perfectly fine but the InsertResult has incorrect key value.
looks like Typeorm attached a '0' end of the id string.
InsertResult {
identifiers: [ { id: '900719950050204930' } ],
generatedMaps: [ { id: '900719950050204930' } ],
raw: ResultSetHeader {
fieldCount: 0,
affectedRows: 1,
insertId: '90071995005020493',
info: '',
serverStatus: 2,
warningStatus: 0
}
}
the correct id is '90071995005020493'
but identifiers and generatedMaps property has '900719950050204930'
It happend when I used 'save()' method too.
the output entity get incorrect key value.
why it happend? how can i fix it...
it's my entity
export class MyEntity{
@PrimaryGeneratedColumn({
name: 'id',
type: 'bigint',
comment: 'id',
})
id: string;
@Column('varchar', {
name: 'header',
default: '',
comment: 'header',
})
header: string;
@Column('varchar', {
name: 'title',
default: '',
comment: 'title',
})
title: string;
}
and insert() method call
const newMyEntity = this.myEntityRepository.create();
newMyEntity.header = '';
newMyEntity.title = '';
const insertResult = await this.myEntityRepository.insert(newMyEntity);