UNPKG

2.47 kBTypeScriptView Raw
1import { Connection, SelectQueryBuilder } from "..";
2import { EntitySchemaIndexOptions } from "./EntitySchemaIndexOptions";
3import { EntitySchemaColumnOptions } from "./EntitySchemaColumnOptions";
4import { EntitySchemaRelationOptions } from "./EntitySchemaRelationOptions";
5import { OrderByCondition } from "../find-options/OrderByCondition";
6import { TableType } from "../metadata/types/TableTypes";
7import { EntitySchemaUniqueOptions } from "./EntitySchemaUniqueOptions";
8import { EntitySchemaCheckOptions } from "./EntitySchemaCheckOptions";
9import { EntitySchemaExclusionOptions } from "./EntitySchemaExclusionOptions";
10/**
11 * Interface for entity metadata mappings stored inside "schemas" instead of models decorated by decorators.
12 */
13export declare class EntitySchemaOptions<T> {
14 /**
15 * Name of the schema it extends.
16 */
17 extends?: string;
18 /**
19 * Target bind to this entity schema. Optional.
20 */
21 target?: Function;
22 /**
23 * Entity name.
24 */
25 name: string;
26 /**
27 * Table name.
28 */
29 tableName?: string;
30 /**
31 * Database name. Used in MySql and Sql Server.
32 */
33 database?: string;
34 /**
35 * Schema name. Used in Postgres and Sql Server.
36 */
37 schema?: string;
38 /**
39 * Table type.
40 */
41 type?: TableType;
42 /**
43 * Specifies a property name by which queries will perform ordering by default when fetching rows.
44 */
45 orderBy?: OrderByCondition;
46 /**
47 * Entity column's options.
48 */
49 columns: {
50 [P in keyof T]?: EntitySchemaColumnOptions;
51 };
52 /**
53 * Entity relation's options.
54 */
55 relations?: {
56 [P in keyof T]?: EntitySchemaRelationOptions;
57 };
58 /**
59 * Entity indices options.
60 */
61 indices?: EntitySchemaIndexOptions[];
62 /**
63 * Entity uniques options.
64 */
65 uniques?: EntitySchemaUniqueOptions[];
66 /**
67 * Entity check options.
68 */
69 checks?: EntitySchemaCheckOptions[];
70 /**
71 * Entity exclusion options.
72 */
73 exclusions?: EntitySchemaExclusionOptions[];
74 /**
75 * Indicates if schema synchronization is enabled or disabled for this entity.
76 * If it will be set to false then schema sync will and migrations ignore this entity.
77 * By default schema synchronization is enabled for all entities.
78 */
79 synchronize?: boolean;
80 /**
81 * View expression.
82 */
83 expression?: string | ((connection: Connection) => SelectQueryBuilder<any>);
84}
85
\No newline at end of file