Optional
charsetOptional
collateOptional
commentOptional
createdOverride the name of the createdAt column if a string is provided, or disable it if false. Timestamps must be true. Not affected by underscored setting.
Optional
defaultDefine the default search scope to use for this model. Scopes have the same form as the options passed to find / findAll.
Optional
deletedOverride the name of the deletedAt column if a string is provided, or disable it if false. Timestamps must be true. Not affected by underscored setting.
Optional
engineYou can also change the database engine, e.g. to MyISAM. InnoDB is the default.
Optional
freezeIf freezeTableName is true, sequelize will not try to alter the DAO name to get the table name. Otherwise, the dao name will be pluralized. Default false.
Optional
getterAllows defining additional getters that will be available on model instances.
Optional
hasIndicates if the model's table has a trigger associated with it. Default false.
Optional
hooksAn object of hook function that are called before and after certain lifecycle events. See Hooks for more information about hook functions and their signatures. Each property can either be a function, or an array of functions.
Optional
indexesIndexes for the provided database table
Optional
initialSet the initial AUTO_INCREMENT value for the table in MySQL.
Optional
modelOptional
nameAn object with two attributes, singular
and plural
, which are used when this model is associated to
others.
Optional
omitDon't persits null values. This means that all columns with null values will not be saved.
Optional
paranoidCalling destroy will not delete the model, but instead set a deletedAt timestamp if this is true. Needs timestamps=true to work. Default false.
Optional
schemaOptional
scopesMore scopes, defined in the same way as defaultScope above. See Model.scope
for more information about
how scopes are defined, and what you can do with them
Optional
setterAllows defining additional setters that will be available on model instances.
Optional
tablepluralized model name, unless freezeTableName is true, in which case it uses model name
verbatim
Optional
timestampsAdds createdAt and updatedAt timestamps to the model. Default true.
Optional
underscoredConverts all camelCased columns to underscored if true. Default false.
Optional
updatedOverride the name of the updatedAt column if a string is provided, or disable it if false. Timestamps must be true. Not affected by underscored setting.
Optional
validateAn object of model wide validations. Validations have access to all model values via this
. If the
validator function takes an argument, it is asumed to be async, and is called with a callback that
accepts an optional error.
Optional
versionEnable optimistic locking. When enabled, sequelize will add a version count attribute to the model and throw an OptimisticLockingError error when stale instances are saved. Set to true or a string with the attribute name you want to use to enable.
Optional
whereSpecify the scopes merging strategy (default 'overwrite'). Valid values are 'and' and 'overwrite'.
When the 'and' strategy is set, scopes will be grouped using the Op.and operator.
For instance merging scopes containing { where: { myField: 1 }}
and { where: { myField: 2 }}
will result in
{ where: { [Op.and]: [{ myField: 1 }, { myField: 2 }] } }
.
When the 'overwrite' strategy is set, scopes containing the same attribute in a where clause will be overwritten by the lastly defined one.
For instance merging scopes containing { where: { myField: 1 }}
and { where: { myField: 2 }}
will result in
{ where: { myField: 2 } }
.
false
Generated using TypeDoc
Finaly you can specify a comment for the table in MySQL and PG