Sequelize.define() method
Defines a model from an attribute map rather than from a decorated class.
Signature:
define<TInstance, _TAttributes>(modelName: string, attributes: ModelAttributes, options?: ModelOptions): any;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
modelName |
string |
Name to register the model under. |
|
attributes |
ModelAttributes |
Column definitions, as sequelize's own |
|
options |
ModelOptions |
(Optional) Model options. |
Returns:
any
The generated model class.
Remarks
Sequelize's own define() builds on its Model; this one builds on BaseModel, so a model defined this way gets the view handling, the widened returning and the serialization of this package. Decorated classes registered through addModels() are the usual route, and the one database() takes.