Schema Builder

The schema builder is used by the migrator class to create the entity's schema.

.apply()

Persists the schema to the database, returns a promise.

schemaBuilder.apply();

.bigInteger()

Define a column type as BIGINT. Field object is defined by the field options.

schemaBuilder.bigInteger(table, field);

.binary()

Define a column type as BINARY.

schemaBuilder.binary(table, field);

.boolean()

Define a column type as BOOLEAN.

schemaBuilder.boolean()

.create()

Creates the schema.

schemaBuilder.create();

.date()

Define a column type as DATE.

schemaBuilder.date(table, field);

.dateTime()

Define a column type as DATETIME.

schemaBuilder.datetime(table, field);
//or
schemaBuilder.dateTime(table, field);

.decimal()

Define a column type as DECIMAL. If precision and scale are not defined on the field options, precision will be set to 8 and scale to 2.

schemaBuilder.decimal(table, field);

.enumeration()

Define a column type as ENUM.

schemaBuilder.enumeration(table, field);

.float()

Define a column type as FLOAT. If precision and scale are not defined on the field options, precision will be set to 8 and scale to 2.

schemaBuilder(table, field);

.getSQL()

Gets the schema queries.

schemaBuilder.getSQL();

.integer()

Define a column type as INT.

schemaBuilder.integer(table, field);

.json()

Define a column type as JSON.

schemaBuilder.json(table, field);

.jsonb()

Define a column type as JSONB.

schemaBuilder.jsonb(table, field);

.string()

Define a column type as VARCHAR. If size is not defined on the field options, it defaults to 255.

schemaBuilder.string(table, field);

.text()

Define a column type as TEXT.

schemaBuilder.text(table, field);

.time()

Define a column type as TIME.

schemaBuilder.time(table, field);

.timestamp()

Define a column type as TIMESTAMP.

schemaBuilder.timestamp(table, field);

.uuid()

Define a column type as CHAR(36). (UUID on postgresql)

schemaBuilder.uuid(table, field);

results matching ""

    No results matching ""