Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RelationJoinColumnBuilder

Builds join column for the many-to-one and one-to-one owner relations.

Cases it should cover:

  1. when join column is set with custom name and without referenced column name we need automatically set referenced column name - primary ids by default
joincolumn({

name: "custom_name" })

  1. when join column is set with only referenced column name we need automatically set join column name - relation name + referenced column name
joincolumn({

referencedColumnName: "title" })

  1. when join column is set without both referenced column name and join column name we need to automatically set both of them
joincolumn()
  1. when join column is not set at all (as in case of @ManyToOne relation) we need to create join column for it with proper referenced column name and join column name

  2. when multiple join columns set none of referencedColumnName and name can be optional both options are required

joincolumn([
 { name: "category_title", referencedColumnName: "type" },
 { name: "category_title", referencedColumnName: "name" },

])

Since for many-to-one relations having JoinColumn decorator is not required, we need to go thought each many-to-one relation without join column decorator set and create join column metadata args for them.

Hierarchy

  • RelationJoinColumnBuilder

Index

Constructors

constructor

Properties

Private connection

connection: Connection

Methods

build

Private collectColumns

Protected collectReferencedColumns

Generated using TypeDoc