API 参考
    正在准备搜索索引...

    接口 EntitySchemaRelationOptions

    interface EntitySchemaRelationOptions {
        cascade?:
            | boolean
            | ("insert" | "update" | "remove" | "soft-remove" | "recover")[];
        createForeignKeyConstraints?: boolean;
        default?: any;
        deferrable?: DeferrableType;
        eager?: boolean;
        inverseSide?: string;
        joinColumn?: boolean | JoinColumnOptions | JoinColumnOptions[];
        joinTable?: boolean | JoinTableOptions | JoinTableMultipleColumnsOptions;
        lazy?: boolean;
        nullable?: boolean;
        onDelete?: OnDeleteType;
        onUpdate?: OnUpdateType;
        orphanedRowAction?: "nullify" | "delete" | "soft-delete" | "disable";
        persistence?: boolean;
        primary?: boolean;
        target: EntityTarget<any>;
        treeChildren?: boolean;
        treeParent?: boolean;
        type: RelationType;
    }
    索引

    属性

    cascade?:
        | boolean
        | ("insert" | "update" | "remove" | "soft-remove" | "recover")[]

    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.

    createForeignKeyConstraints?: boolean

    Indicates whether foreign key constraints will be created for join columns. Can be used only for many-to-one and owner one-to-one relations. Defaults to true.

    default?: any

    Default database value.

    deferrable?: DeferrableType

    Indicate if foreign key constraints can be deferred.

    eager?: boolean

    Indicates if this relation will be eagerly loaded.

    inverseSide?: string

    Inverse side of the relation.

    joinColumn?: boolean | JoinColumnOptions | JoinColumnOptions[]

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

    joinTable?: boolean | JoinTableOptions | JoinTableMultipleColumnsOptions

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

    lazy?: boolean

    Indicates if this relation will be lazily loaded.

    nullable?: boolean

    Indicates if relation column value can be nullable or not.

    onDelete?: OnDeleteType

    Database cascade action on delete.

    onUpdate?: OnUpdateType

    Database cascade action on update.

    orphanedRowAction?: "nullify" | "delete" | "soft-delete" | "disable"

    When a parent is saved (with cascading but) without a child row that still exists in database, this will control what shall happen to them. delete will remove these rows from database. nullify will remove the relation key. skip will keep the relation intact. Removal of related item is only possible through its own repo.

    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.

    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.

    target: EntityTarget<any>

    Indicates with which entity this relation is made.

    treeChildren?: boolean

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

    treeParent?: boolean

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

    type: RelationType

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