Kononnable/typeorm-model-generator

When typeorm-model-generator decided to add number to fieldName?

wizardnet972 opened this issue · 1 comments

Why when I run typeorm-model-generator I get 2 added to the field name?

When I debug the source code I log the databaseModel:

In the picture you can see the relations have fieldName with value: companyCd2, it should be companies.

So my question is in which cases it adds a number to the field name?

image

luiys commented

how to solve this?

I'm having the following problem:

@Column("int", { name: "grupo", nullable: true })
 group: number | null; 
 
@ManyToOne(() => GrupoAcesso, (grupoAcesso) => grupoAcesso.grupoAcessoMenus, {
    onDelete: "NO ACTION",
    onUpdate: "NO ACTION",
})
@JoinColumn([{ name: "grupo", referencedColumnName: "id" }])
group2: GrupoAcesso;

I just need the relation to be generated

typeorm-model-generator version: 0.4.6
database: mysql