Sequelize class
Sequelize's own connection class, taught about views, column indices and the widened returning option.
Signature:
export declare class Sequelize extends SequelizeOrigin
Extends: SequelizeOrigin
Remarks
Returned by database(), which is how a service normally gets one. Four things differ from the class it extends.
Views are first-class: a model declared with View or DynamicView is created as a view after every table exists, dropped as a view, and skipped by the table sync. A dynamic view goes further — its definition carries @{name} placeholders, and the select-query generator substitutes them into the statement at query time, so one model can be read with different parameters, including when it is reached through a join.
Column indices declared with ColumnIndex or NullableIndex are created as part of the same sync, which sequelize has no notion of at all.
returning may name columns rather than being a boolean, both on the write methods and on a raw query().
Example
const orm = database(dbConfig); // a Sequelize, already connected
await orm.sync(); // tables, then views, then indices
await orm.sync({ withNoViews: true }); // tables and indices only
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
Defines a model from an attribute map rather than from a decorated class. | ||
|
The registered models that declare at least one column index. | ||
|
The query interface for this connection, with view support and the widened | ||
|
The registered models that are declared as views. | ||
|
Runs a raw statement, honouring a | ||
|
Creates every table, then every view, then every column index. | ||
|
Creates the column indices declared across every registered model. | ||
|
Replaces every model that is declared as a view. |