222
schangxiang@126.com
2025-06-13 6a8393408d8cefcea02b7a598967de8dc1e565c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { ColumnMetadata } from "./ColumnMetadata";
import { EntityMetadata } from "./EntityMetadata";
import { NamingStrategyInterface } from "../naming-strategy/NamingStrategyInterface";
import { DeferrableType } from "./types/DeferrableType";
import { OnDeleteType } from "./types/OnDeleteType";
import { OnUpdateType } from "./types/OnUpdateType";
/**
 * Contains all information about entity's foreign key.
 */
export declare class ForeignKeyMetadata {
    /**
     * Entity metadata where this foreign key is.
     */
    entityMetadata: EntityMetadata;
    /**
     * Entity metadata which this foreign key references.
     */
    referencedEntityMetadata: EntityMetadata;
    /**
     * Array of columns of this foreign key.
     */
    columns: ColumnMetadata[];
    /**
     * Array of referenced columns.
     */
    referencedColumns: ColumnMetadata[];
    /**
     * What to do with a relation on deletion of the row containing a foreign key.
     */
    onDelete?: OnDeleteType;
    /**
     * What to do with a relation on update of the row containing a foreign key.
     */
    onUpdate?: OnUpdateType;
    /**
     * When to check the constraints of a foreign key.
     */
    deferrable?: DeferrableType;
    /**
     * Gets the table name to which this foreign key is referenced.
     */
    referencedTablePath: string;
    /**
     * Gets foreign key name.
     */
    name: string;
    /**
     * Gets array of column names.
     */
    columnNames: string[];
    /**
     * Gets array of referenced column names.
     */
    referencedColumnNames: string[];
    constructor(options: {
        entityMetadata: EntityMetadata;
        referencedEntityMetadata: EntityMetadata;
        namingStrategy?: NamingStrategyInterface;
        columns: ColumnMetadata[];
        referencedColumns: ColumnMetadata[];
        onDelete?: OnDeleteType;
        onUpdate?: OnUpdateType;
        deferrable?: DeferrableType;
    });
    /**
     * Builds some depend foreign key properties.
     * Must be called after all entity metadatas and their columns are built.
     */
    build(namingStrategy: NamingStrategyInterface): void;
}