Given the following two TypeORM entities that have a @ManyToMany relationship:
@Entity({ name: 'products' })
export class ProductEntity {
@PrimaryColumn()
id: number;
@Column()
name: string;
@ManyToMany(type => CategoryEntity, { eager: true })
@JoinTable({ name: 'products_categories' })
categories: CategoryEntity[];
}
@Entity({ name: 'categories' })
export class CategoryEntity {
@PrimaryColumn({ length: 40 })
code: string;
}
As a result I get created a table called "products_categories"
with the following column names:
productsId
categoriesCode
Is there a way of giving these two columns custom names? I would like to rename them as follows:
productsId
->productId
categoriesCode
->categoryCode