This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Description
Considering the following DDL
CREATE TABLE `data` (
`id` int(10) unsigned NOT NULL DEFAULT '0',
`ai` int(10) unsigned NOT NULL AUTO_INCREMENT,
`pk` char(32) NOT NULL,
PRIMARY KEY (`pk`),
KEY (`ai`)
)
The generated model is
@Index('ai', ['ai'], {})
@Entity('data', { schema: 'test' })
export class data {
@Column('int', { name: 'id', unsigned: true, default: () => "'0'" })
id: number;
@PrimaryGeneratedColumn({ type: 'int', name: 'ai', unsigned: true })
ai: number;
@Column('char', { primary: true, name: 'pk', length: 32 })
pk: string;
}
In this case ai isn't the Primary Key. It should be checked before applying @PrimaryGeneratedColumn decorator.