You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Duplicate junction tables created for ManyToMany relation with custom junctional table name #10643
typeorm always creates junction tables with the name you provide in JoinTable.name, and since this name is different from the entity FooFeature you defined, both of them are created.
You can either make both FooFeature and JoinTable have similar names, or u can omit creating the FooFeature manually and use the one typeorm creates
@Entity({name: "foo_feature"})// <- table created with name foo_featureexportclassFooFeature{
@PrimaryGeneratedColumn('identity')id: number;}
@Entity({name: "foo"})exportclassFoo{
@PrimaryGeneratedColumn('identity')id: number;
@ManyToMany(()=>FooFeature)
@JoinTable({name: "foo_included_features",// <- typeorm uses this to create a tablejoinColumn: {name: "foo",referencedColumnName: "id",},inverseJoinColumn: {name: "foo_feature",referencedColumnName: "id",},})included: typeorm.Relation<FooFeature[]>;}
Activity
ragrag commentedon Oct 27, 2024
typeorm always creates junction tables with the name you provide in JoinTable.name, and since this name is different from the entity FooFeature you defined, both of them are created.
You can either make both FooFeature and JoinTable have similar names, or u can omit creating the FooFeature manually and use the one typeorm creates