Skip to main content

Schema<S>

A schema is a collection of tables. It is used to define the structure of a database.

Type Parameters

Type ParameterDefault type
S extends SchemaTypeSchemaType

Constructors

new Schema()

new Schema<S>(tables): Schema<S>

Parameters

ParameterType
tablesS | Table[]

Returns

Schema<S>

Properties

PropertyModifierType
propsreadonlyS
tablesreadonlyTable[]
typesreadonlySchemaTableType<S>

Methods

toJSON()

toJSON(): {
tables: {
columns: {
name: string;
type: undefined | ColumnType;
}[];
indexes: {
columns: {
ascending: undefined | boolean;
name: string;
type: ColumnType;
}[];
name: string;
}[];
insert_only: boolean;
local_only: boolean;
name: string;
view_name: string;
}[];
}

Returns

{
tables: {
columns: {
name: string;
type: undefined | ColumnType;
}[];
indexes: {
columns: {
ascending: undefined | boolean;
name: string;
type: ColumnType;
}[];
name: string;
}[];
insert_only: boolean;
local_only: boolean;
name: string;
view_name: string;
}[];
}
NameType
tables{ columns: { name: string; type: undefined | ColumnType; }[]; indexes: { columns: { ascending: undefined | boolean; name: string; type: ColumnType; }[]; name: string; }[]; insert_only: boolean; local_only: boolean; name: string; view_name: string; }[]

validate()

validate(): void

Returns

void