Skip to main content
Deno 2 is finally here 🎉️
Learn more
Latest
interface EntitySchemaRelationOptions
import { type EntitySchemaRelationOptions } from "https://deno.land/x/typeorm@v0.2.23-rc10/src/entity-schema/EntitySchemaRelationOptions.ts";

Properties

target: Function | string

Indicates with which entity this relation is made.

type: RelationType

Type of relation. Can be one of the value of the RelationTypes class.

optional
inverseSide: string

Inverse side of the relation.

optional
lazy: boolean

Indicates if this relation will be lazily loaded.

optional
eager: boolean

Indicates if this relation will be eagerly loaded.

optional
persistence: boolean

Indicates if persistence is enabled for the relation. By default its enabled, but if you want to avoid any changes in the relation to be reflected in the database you can disable it. If its disabled you can only change a relation from inverse side of a relation or using relation query builder functionality. This is useful for performance optimization since its disabling avoid multiple extra queries during entity save.

optional
primary: boolean

Indicates if this relation will be a primary key. Can be used only for many-to-one and owner one-to-one relations.

optional
joinTable: boolean | JoinTableOptions | JoinTableMultipleColumnsOptions

Join table options of this column. If set to true then it simply means that it has a join table.

optional
joinColumn: boolean | JoinColumnOptions

Join column options of this column. If set to true then it simply means that it has a join column.

optional
treeParent: boolean

Indicates if this is a parent (can be only many-to-one relation) relation in the tree tables.

optional
treeChildren: boolean

Indicates if this is a children (can be only one-to-many relation) relation in the tree tables.

optional
cascade: boolean | ("insert" | "update" | "remove")[]

If set to true then it means that related object can be allowed to be inserted / updated / removed to the db. This is option a shortcut if you would like to set cascadeInsert, cascadeUpdate and cascadeRemove to true.

optional
default: any

Default database value.

optional
nullable: boolean

Indicates if relation column value can be nullable or not.

optional
onDelete: OnDeleteType

Database cascade action on delete.

optional
onUpdate: OnUpdateType

Database cascade action on update.

optional
deferrable: DeferrableType

Indicate if foreign key constraints can be deferred.