Builder to specify the schema of a table.




columns: {
    [key: string]: ColumnBuilder;
} = {}

Mapping of column name to column schemata.

Type declaration

constraints: {
    [key: string]: ConstraintBuilder;
} = {}

Mapping of constraint name to constraint schemata.

Type declaration

dirty: boolean = false

True if the schema has been modified since created/loaded.

existsInSchema: boolean = false

True if this resource exists, in some form, in the schema.

indexes: {
    [key: string]: IndexBuilder;
} = {}

Mapping of index name to index schemata.

Type declaration

name: string

The name of the schema item.

originalFromSchema?: TableBuilder

If the resource exists in the schema, the unaltered values it has.

shouldDrop: "yes" | "exists" | "no" = 'no'

Whether or not the schema item should be dropped.

  • exists - drop if exists
shouldRenameTo?: string

The name the schema item should have if renaming.

shouldSkipIfExists: boolean = false

If true, apply IF NOT EXISTS syntax.