proper colum names in ManyToMany relationships
This commit is contained in:
parent
5cdf4691f4
commit
d797c3d06d
@ -140,18 +140,18 @@ export default abstract class AbstractDriver {
|
||||
joinColumns: junctionEntity.relations[0].joinColumnOptions!.map(
|
||||
(v, i) => {
|
||||
return {
|
||||
name: v.referencedColumnName,
|
||||
referencedColumnName: junctionEntity.relations[1]
|
||||
.joinColumnOptions![i].referencedColumnName
|
||||
referencedColumnName: v.referencedColumnName,
|
||||
name: junctionEntity.relations[0]
|
||||
.joinColumnOptions![i].name
|
||||
};
|
||||
}
|
||||
),
|
||||
inverseJoinColumns: junctionEntity.relations[1].joinColumnOptions!.map(
|
||||
(v, i) => {
|
||||
return {
|
||||
name: v.referencedColumnName,
|
||||
referencedColumnName: junctionEntity.relations[0]
|
||||
.joinColumnOptions![i].referencedColumnName
|
||||
referencedColumnName: v.referencedColumnName,
|
||||
name: junctionEntity.relations[1]
|
||||
.joinColumnOptions![i].name
|
||||
};
|
||||
}
|
||||
)
|
||||
|
@ -8,11 +8,14 @@ import { {{toEntityName .}} } from './{{toFileName .}}'
|
||||
{{#generated}}@PrimaryGeneratedColumn({ type:"{{type}}", {{/generated}}{{^generated}}@Column("{{type}}",{ {{#primary}}primary:{{primary}},{{/primary}}{{/generated}}{{json options}}{{#default}},default: {{.}},{{/default}} })
|
||||
{{printPropertyVisibility}}{{toPropertyName tscName}}{{strictMode}}:{{tscType}};
|
||||
|
||||
{{/inline}}
|
||||
{{#*inline "JoinColumnOptions"}}
|
||||
{ name: "{{name}}", referencedColumnName: "{{toPropertyName referencedColumnName}}" },
|
||||
{{/inline}}
|
||||
{{#*inline "Relation"}}
|
||||
@{{relationType}}(()=>{{toEntityName relatedTable}},{{toEntityName relatedTable}}=>{{toEntityName relatedTable}}.{{toPropertyName relatedField}}{{#if relationOptions}},{ {{json relationOptions}} }{{/if}})
|
||||
{{#if joinColumnOptions}}@JoinColumn([{{#joinColumnOptions}}{ name: "{{name}}", referencedColumnName: "{{toPropertyName referencedColumnName}}" },{{/joinColumnOptions}}]){{/if}}
|
||||
{{#if joinTableOptions}}@JoinTable({ {{json joinTableOptions}} }){{/if}}
|
||||
{{#if joinColumnOptions}}@JoinColumn([{{#joinColumnOptions}}{{> JoinColumnOptions}}{{/joinColumnOptions}}]){{/if}}
|
||||
{{#joinTableOptions}}@JoinTable({ name:"{{name}}", joinColumns:[{{#joinColumns}}{{> JoinColumnOptions}}{{/joinColumns}}],inverseJoinColumns:[{{#inverseJoinColumns}}{{> JoinColumnOptions}}{{/inverseJoinColumns}}],{{#database}}database:"{{.}}",{{/database}}{{#schema}}schema:"{{.}}"{{/schema}} }){{/joinTableOptions}}
|
||||
{{printPropertyVisibility}}{{toPropertyName fieldName}}{{strictMode}}:{{toRelation (toEntityName relatedTable) relationType}};
|
||||
|
||||
{{/inline}}
|
||||
|
Loading…
Reference in New Issue
Block a user