@types/sequelize

  • Version 4.28.20
  • Published
  • 245 kB
  • 4 dependencies
  • MIT license

Install

npm i @types/sequelize
yarn add @types/sequelize
pnpm add @types/sequelize

Overview

TypeScript definitions for sequelize

Index

Variables

Interfaces

Type Aliases

Variables

variable sequelize

var sequelize: sequelize.SequelizeStatic;

    Interfaces

    interface AccessDeniedError

    interface AccessDeniedError extends ConnectionError {}

      construct signature

      new (parent: Error): AccessDeniedError;
      • Thrown when a connection to a database is refused due to insufficient privileges

      interface AddCheckConstraintOptions

      interface AddCheckConstraintOptions {}

        property name

        name?: string | undefined;

          property type

          type: 'check';

            property where

            where?: AnyWhereOptions | undefined;

              interface AddDefaultConstraintOptions

              interface AddDefaultConstraintOptions {}

                property defaultValue

                defaultValue?: any;

                  property name

                  name?: string | undefined;

                    property type

                    type: 'default';

                      interface AddForeignKeyConstraintOptions

                      interface AddForeignKeyConstraintOptions {}

                        property name

                        name?: string | undefined;

                          property onDelete

                          onDelete: string;

                            property onUpdate

                            onUpdate: string;

                              property references

                              references?:
                              | {
                              table: string;
                              field: string;
                              }
                              | undefined;

                                property type

                                type: 'foreign key';

                                  interface AddPrimaryKeyConstraintOptions

                                  interface AddPrimaryKeyConstraintOptions {}

                                    property name

                                    name?: string | undefined;

                                      property type

                                      type: 'primary key';

                                        interface AddScopeOptions

                                        interface AddScopeOptions {}
                                        • AddScope Options for Model.addScope

                                        property override

                                        override: boolean;
                                        • If a scope of the same name already exists, should it be overwritten?

                                        interface AddUniqueConstraintOptions

                                        interface AddUniqueConstraintOptions {}

                                          property name

                                          name?: string | undefined;

                                            property type

                                            type: 'unique';

                                              interface AggregateOptions

                                              interface AggregateOptions extends LoggingOptions {}
                                              • Options used for Model.aggregate

                                              property dataType

                                              dataType?: DataTypeAbstract | string | undefined;
                                              • The type of the result. If field is a field in this Model, the default will be the type of that field, otherwise defaults to float.

                                              property distinct

                                              distinct?: boolean | undefined;
                                              • Applies DISTINCT to the field being aggregated over

                                              property plain

                                              plain?: boolean | undefined;
                                              • When true, the first returned value of aggregateFunction is cast to dataType and returned. If additional attributes are specified, along with group clauses, set plain to false to return all values of all returned rows. Defaults to true

                                              property transaction

                                              transaction?: Transaction | undefined;
                                              • The transaction that the query should be executed under

                                              property where

                                              where?: AnyWhereOptions | undefined;
                                              • A hash of search attributes.

                                              interface and

                                              interface and {}

                                                property args

                                                args: any[];

                                                  interface andStatic

                                                  interface andStatic {}

                                                    construct signature

                                                    new (...args: Array<string | Object>): and;
                                                    • An AND query

                                                      Parameter args

                                                      Each argument will be joined by AND

                                                    interface AnyWhereOptions

                                                    interface AnyWhereOptions {}
                                                    • A hash of attributes to describe your search, accepting any field names. See WhereOptions for details.

                                                    index signature

                                                    [field: string]: Array<WhereOptions<any>> | Object | null;

                                                      interface AssociationForeignKeyOptions

                                                      interface AssociationForeignKeyOptions extends ColumnOptions {}
                                                      • Foreign Key Options

                                                        See Also

                                                        • AssociationOptions

                                                      property name

                                                      name?: string | undefined;
                                                      • Attribute name for the relation

                                                      property unique

                                                      unique?: boolean | string | undefined;

                                                        interface AssociationOptions

                                                        interface AssociationOptions {}
                                                        • Options provided when associating models

                                                          See Also

                                                          • Association class

                                                        property as

                                                        as?: string | { singular: string; plural: string } | undefined;
                                                        • The alias of this model, in singular form. See also the name option passed to sequelize.define. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the assocition, you should provide the same alias when eager loading and when getting assocated models. Defaults to the singularized name of target

                                                        property constraints

                                                        constraints?: boolean | undefined;
                                                        • Should on update and on delete constraints be enabled on the foreign key.

                                                        property foreignKey

                                                        foreignKey?: string | AssociationForeignKeyOptions | undefined;
                                                        • The name of the foreign key in the target table or an object representing the type definition for the foreign column (see Sequelize.define for syntax). When using an object, you can add a name property to set the name of the column. Defaults to the name of source + primary key of source

                                                        property foreignKeyConstraint

                                                        foreignKeyConstraint?: boolean | undefined;

                                                          property hooks

                                                          hooks?: boolean | undefined;
                                                          • Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if User.hasOne(Profile, {onDelete: 'cascade', hooks:true}), the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks.

                                                            Defaults to false

                                                          property onDelete

                                                          onDelete?: string | undefined;
                                                          • What happens when delete occurs.

                                                            Cascade if this is a n:m, and set null if it is a 1:m

                                                            Defaults to 'SET NULL' or 'CASCADE'

                                                          property onUpdate

                                                          onUpdate?: string | undefined;
                                                          • What happens when update occurs

                                                            Defaults to 'CASCADE'

                                                          property scope

                                                          scope?: AssociationScope | undefined;

                                                            interface AssociationOptionsBelongsTo

                                                            interface AssociationOptionsBelongsTo extends AssociationOptions {}
                                                            • Options provided when associating models with belongsTo relationship

                                                              See Also

                                                              • Association class belongsTo method

                                                            property keyType

                                                            keyType?: DataTypeAbstract | undefined;
                                                            • A string or a data type to represent the identifier in the table

                                                            property targetKey

                                                            targetKey?: string | undefined;
                                                            • The name of the field to use as the key for the association in the target table. Defaults to the primary key of the target table

                                                            interface AssociationOptionsBelongsToMany

                                                            interface AssociationOptionsBelongsToMany extends AssociationOptionsManyToMany {}
                                                            • Options provided when associating models with belongsToMany relationship

                                                              See Also

                                                              • Association class belongsToMany method

                                                            property otherKey

                                                            otherKey?: string | AssociationForeignKeyOptions | undefined;
                                                            • The name of the foreign key in the join table (representing the target model) or an object representing the type definition for the other column (see Sequelize.define for syntax). When using an object, you can add a name property to set the name of the colum. Defaults to the name of target + primary key of target

                                                            property through

                                                            through: Model<any, any> | string | ThroughOptions;
                                                            • The name of the table that is used to join source and target in n:m associations. Can also be a sequelize model if you want to define the junction table yourself and add extra attributes to it.

                                                              In 3.4.1 version of Sequelize, hasMany's use of through gives an error, and on the other hand through option for belongsToMany has been made required.

                                                              See Also

                                                              • https://github.com/sequelize/sequelize/blob/v3.4.1/lib/associations/has-many.js

                                                              • https://github.com/sequelize/sequelize/blob/v3.4.1/lib/associations/belongs-to-many.js

                                                            property timestamps

                                                            timestamps?: boolean | undefined;
                                                            • Should the join model have timestamps

                                                            property uniqueKey

                                                            uniqueKey?: string | undefined;
                                                            • Belongs-To-Many creates a unique key when primary key is not present on through model. This unique key name can be overridden using uniqueKey option.

                                                            interface AssociationOptionsHasMany

                                                            interface AssociationOptionsHasMany extends AssociationOptionsManyToMany {}
                                                            • Options provided when associating models with hasMany relationship

                                                              See Also

                                                              • Association class hasMany method

                                                            property keyType

                                                            keyType?: DataTypeAbstract | undefined;
                                                            • A string or a data type to represent the identifier in the table

                                                            property sourceKey

                                                            sourceKey?: string | undefined;
                                                            • A string to represent the name of the field to use as the key for an 1 to many association in the source table.

                                                              See Also

                                                              • http://docs.sequelizejs.com/class/lib/model.js~Model.html#static-method-hasMany

                                                              • https://github.com/sequelize/sequelize/blob/b4fd46426db9cdbb97074bea121203d565e4195d/lib/associations/has-many.js#L81

                                                            interface AssociationOptionsHasOne

                                                            interface AssociationOptionsHasOne extends AssociationOptions {}
                                                            • Options provided when associating models with hasOne relationship

                                                              See Also

                                                              • Association class hasOne method

                                                            property keyType

                                                            keyType?: DataTypeAbstract | undefined;
                                                            • A string or a data type to represent the identifier in the table

                                                            interface AssociationOptionsManyToMany

                                                            interface AssociationOptionsManyToMany extends AssociationOptions {}
                                                            • Options provided for many-to-many relationships

                                                              See Also

                                                              • AssociationOptionsHasMany

                                                              • AssociationOptionsBelongsToMany

                                                            property scope

                                                            scope?: AssociationScope | undefined;
                                                            • A key/value set that will be used for association create and find defaults on the target. (sqlite not supported for N:M)

                                                            interface Associations

                                                            interface Associations {}
                                                            • Creating assocations in sequelize is done by calling one of the belongsTo / hasOne / hasMany functions on a model (the source), and providing another model as the first argument to the function (the target).

                                                              * hasOne - adds a foreign key to target * belongsTo - add a foreign key to source * hasMany - adds a foreign key to target, unless you also specify that target hasMany source, in which case a junction table is created with sourceId and targetId

                                                              Creating an association will add a foreign key constraint to the attributes. All associations use CASCADE on update and SET NULL on delete, except for n:m, which also uses CASCADE on delete.

                                                              When creating associations, you can provide an alias, via the as option. This is useful if the same model is associated twice, or you want your association to be called something other than the name of the target model.

                                                              As an example, consider the case where users have many pictures, one of which is their profile picture. All pictures have a userId, but in addition the user model also has a profilePictureId, to be able to easily load the user's profile picture.

                                                              User.hasMany(Picture)
                                                              User.belongsTo(Picture, { as: 'ProfilePicture', constraints: false })
                                                              user.getPictures() // gets you all pictures
                                                              user.getProfilePicture() // gets you only the profile picture
                                                              User.findAll({
                                                              where: ...,
                                                              include: [
                                                              { model: Picture }, // load all pictures
                                                              { model: Picture, as: 'ProfilePicture' }, // load the profile picture. Notice that the spelling must be
                                                              the exact same as the one in the association
                                                              ]
                                                              })

                                                              To get full control over the foreign key column added by sequelize, you can use the foreignKey option. It can either be a string, that specifies the name, or and object type definition, equivalent to those passed to sequelize.define.

                                                              User.hasMany(Picture, { foreignKey: 'uid' })

                                                              The foreign key column in Picture will now be called uid instead of the default userId.

                                                              User.hasMany(Picture, {
                                                              foreignKey: {
                                                              name: 'uid',
                                                              allowNull: false
                                                              }
                                                              })

                                                              This specifies that the uid column can not be null. In most cases this will already be covered by the foreign key costraints, which sequelize creates automatically, but can be useful in case where the foreign keys are disabled, e.g. due to circular references (see constraints: false below).

                                                              When fetching associated models, you can limit your query to only load some models. These queries are written in the same way as queries to find/findAll. To only get pictures in JPG, you can do:

                                                              user.getPictures({
                                                              where: {
                                                              format: 'jpg'
                                                              }
                                                              })

                                                              There are several ways to update and add new assoications. Continuing with our example of users and pictures:

                                                              user.addPicture(p) // Add a single picture
                                                              user.setPictures([p1, p2]) // Associate user with ONLY these two picture, all other associations will be
                                                              deleted user.addPictures([p1, p2]) // Associate user with these two pictures, but don't touch any current
                                                              associations

                                                              You don't have to pass in a complete object to the association functions, if your associated model has a single primary key:

                                                              user.addPicture(req.query.pid) // Here pid is just an integer, representing the primary key of the picture

                                                              In the example above we have specified that a user belongs to their profile picture. Conceptually, this might not make sense, but since we want to add the foreign key to the user model this is the way to do it.

                                                              Note how we also specified constraints: false for profile picture. This is because we add a foreign key from user to picture (profilePictureId), and from picture to user (userId). If we were to add foreign keys to both, it would create a cyclic dependency, and sequelize would not know which table to create first, since user depends on picture, and picture depends on user. These kinds of problems are detected by sequelize before the models are synced to the database, and you will get an error along the lines of `Error: Cyclic dependency found. 'users' is dependent of itself`. If you encounter this, you should either disable some constraints, or rethink your associations completely.

                                                              See Also

                                                              • Sequelize.Model

                                                            method belongsTo

                                                            belongsTo: (
                                                            target: Model<any, any>,
                                                            options?: AssociationOptionsBelongsTo
                                                            ) => IncludeAssociation;
                                                            • Creates an association between this (the source) and the provided target. The foreign key is added on the source.

                                                              Example: Profile.belongsTo(User). This will add userId to the profile table.

                                                              Parameter target

                                                              The model that will be associated with hasOne relationship

                                                              Parameter options

                                                              Options for the association return type of association

                                                            method belongsToMany

                                                            belongsToMany: (
                                                            target: Model<any, any>,
                                                            options: AssociationOptionsBelongsToMany
                                                            ) => IncludeAssociation;
                                                            • Create an N:M association with a join table

                                                              User.belongsToMany(Project)
                                                              Project.belongsToMany(User)

                                                              By default, the name of the join table will be source+target, so in this case projectsusers. This can be overridden by providing either a string or a Model as through in the options.

                                                              If you use a through model with custom attributes, these attributes can be set when adding / setting new associations in two ways. Consider users and projects from before with a join table that stores whether the project has been started yet:

                                                              var UserProjects = sequelize.define('userprojects', {
                                                              started: Sequelize.BOOLEAN
                                                              })
                                                              User.belongsToMany(Project, { through: UserProjects })
                                                              Project.belongsToMany(User, { through: UserProjects })
                                                              jan.addProject(homework, { started: false }) // The homework project is not started yet
                                                              jan.setProjects([makedinner, doshopping], { started: true}) // Both shopping and dinner has been started

                                                              If you want to set several target instances, but with different attributes you have to set the attributes on the instance, using a property with the name of the through model:

                                                              p1.userprojects {
                                                              started: true
                                                              }
                                                              user.setProjects([p1, p2], {started: false}) // The default value is false, but p1 overrides that.

                                                              Similarily, when fetching through a join table with custom attributes, these attributes will be available as an object with the name of the through model.

                                                              user.getProjects().then(function (projects) {
                                                              var p1 = projects[0]
                                                              p1.userprojects.started // Is this project started yet?
                                                              })

                                                              Parameter target

                                                              The model that will be associated with hasOne relationship

                                                              Parameter options

                                                              Options for the association return type of association

                                                            method hasMany

                                                            hasMany: (
                                                            target: Model<any, any>,
                                                            options?: AssociationOptionsHasMany
                                                            ) => IncludeAssociation;
                                                            • Create an association that is either 1:m or n:m.

                                                              // Create a 1:m association between user and project
                                                              User.hasMany(Project)
                                                              // Create a n:m association between user and project
                                                              User.hasMany(Project)
                                                              Project.hasMany(User)

                                                              By default, the name of the join table will be source+target, so in this case projectsusers. This can be overridden by providing either a string or a Model as through in the options. If you use a through model with custom attributes, these attributes can be set when adding / setting new associations in two ways. Consider users and projects from before with a join table that stores whether the project has been started yet:

                                                              var UserProjects = sequelize.define('userprojects', {
                                                              started: Sequelize.BOOLEAN
                                                              })
                                                              User.hasMany(Project, { through: UserProjects })
                                                              Project.hasMany(User, { through: UserProjects })
                                                              jan.addProject(homework, { started: false }) // The homework project is not started yet
                                                              jan.setProjects([makedinner, doshopping], { started: true}) // Both shopping and dinner have been
                                                              started

                                                              If you want to set several target instances, but with different attributes you have to set the attributes on the instance, using a property with the name of the through model:

                                                              p1.userprojects {
                                                              started: true
                                                              }
                                                              user.setProjects([p1, p2], {started: false}) // The default value is false, but p1 overrides that.

                                                              Similarily, when fetching through a join table with custom attributes, these attributes will be available as an object with the name of the through model.

                                                              user.getProjects().then(function (projects) {
                                                              var p1 = projects[0]
                                                              p1.userprojects.started // Is this project started yet?
                                                              })

                                                              Parameter target

                                                              The model that will be associated with hasOne relationship

                                                              Parameter options

                                                              Options for the association return type of association

                                                            method hasOne

                                                            hasOne: (
                                                            target: Model<any, any>,
                                                            options?: AssociationOptionsHasOne
                                                            ) => IncludeAssociation;
                                                            • Creates an association between this (the source) and the provided target. The foreign key is added on the target.

                                                              Example: User.hasOne(Profile). This will add userId to the profile table.

                                                              Parameter target

                                                              The model that will be associated with hasOne relationship

                                                              Parameter options

                                                              Options for the association return type of association

                                                            interface AssociationScope

                                                            interface AssociationScope {}
                                                            • Options for Association Scope

                                                              See Also

                                                              • AssociationOptionsManyToMany

                                                            index signature

                                                            [scopeName: string]: any;
                                                            • The name of the column that will be used for the associated scope and it's value

                                                            interface BaseError

                                                            interface BaseError extends Error, ErrorConstructor {}
                                                            • The Base Error all Sequelize Errors inherit from.

                                                            interface BelongsToCreateAssociationMixin

                                                            interface BelongsToCreateAssociationMixin<TAttributes, TInstance> {}
                                                            • The createAssociation mixin applied to models with belongsTo. An example of usage is as follows:

                                                              User.belongsTo(Role);
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRole...
                                                              // setRole...
                                                              createRole: Sequelize.BelongsToCreateAssociationMixin<RoleAttributes>;
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to/

                                                              • Instance

                                                            call signature

                                                            (
                                                            values?: TAttributes,
                                                            options?:
                                                            | BelongsToCreateAssociationMixinOptions
                                                            | CreateOptions
                                                            | BelongsToSetAssociationMixinOptions
                                                            ): Promise<TInstance>;
                                                            • Create a new instance of the associated model and associate it with this.

                                                              Parameter values

                                                              The values used to create the association.

                                                              Parameter options

                                                              The options passed to target.create and setAssociation.

                                                            interface BelongsToCreateAssociationMixinOptions

                                                            interface BelongsToCreateAssociationMixinOptions {}
                                                            • The options for the createAssociation mixin of the belongsTo association.

                                                              See Also

                                                              • BelongsToCreateAssociationMixin

                                                            interface BelongsToGetAssociationMixin

                                                            interface BelongsToGetAssociationMixin<TInstance> {}
                                                            • The getAssociation mixin applied to models with belongsTo. An example of usage is as follows:

                                                              User.belongsTo(Role);
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttrib>, UserAttrib {
                                                              getRole: Sequelize.BelongsToGetAssociationMixin<RoleInstance>;
                                                              // setRole...
                                                              // createRole...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to/

                                                              • Instance

                                                            call signature

                                                            (options?: BelongsToGetAssociationMixinOptions): Promise<TInstance | null>;
                                                            • Get the associated instance.

                                                              Parameter options

                                                              The options to use when getting the association.

                                                            interface BelongsToGetAssociationMixinOptions

                                                            interface BelongsToGetAssociationMixinOptions {}
                                                            • The options for the getAssociation mixin of the belongsTo association.

                                                              See Also

                                                              • BelongsToGetAssociationMixin

                                                            property scope

                                                            scope?: string | boolean | undefined;
                                                            • Apply a scope on the related model, or remove its default scope by passing false.

                                                            interface BelongsToManyAddAssociationMixin

                                                            interface BelongsToManyAddAssociationMixin<
                                                            TInstance,
                                                            TInstancePrimaryKey,
                                                            TJoinTableAttributes
                                                            > {}
                                                            • The addAssociation mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRoles...
                                                              // setRoles...
                                                              // addRoles...
                                                              addRole: Sequelize.BelongsToManyAddAssociationMixin<RoleInstance, RoleId, UserRoleAttributes>;
                                                              // createRole...
                                                              // removeRole...
                                                              // removeRoles...
                                                              // hasRole...
                                                              // hasRoles...
                                                              // countRoles...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (
                                                            newAssociation?: TInstance | TInstancePrimaryKey,
                                                            options?:
                                                            | BelongsToManyAddAssociationMixinOptions
                                                            | AnyFindOptions
                                                            | BulkCreateOptions
                                                            | InstanceUpdateOptions
                                                            | InstanceDestroyOptions
                                                            | { through: TJoinTableAttributes }
                                                            ): Promise<void>;
                                                            • Associate an instance with this.

                                                              Parameter newAssociation

                                                              An instance or the primary key of an instance to associate with this.

                                                              Parameter options

                                                              The options passed to through.findAll, bulkCreate, update and destroy. Can also hold additional attributes for the join table.

                                                            interface BelongsToManyAddAssociationMixinOptions

                                                            interface BelongsToManyAddAssociationMixinOptions {}
                                                            • The options for the addAssociation mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManyAddAssociationMixin

                                                            property validate

                                                            validate?: boolean | undefined;
                                                            • Run validation for the join model.

                                                            interface BelongsToManyAddAssociationsMixin

                                                            interface BelongsToManyAddAssociationsMixin<
                                                            TInstance,
                                                            TInstancePrimaryKey,
                                                            TJoinTableAttributes
                                                            > {}
                                                            • The addAssociations mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRoles...
                                                              // setRoles...
                                                              addRoles: Sequelize.BelongsToManyAddAssociationsMixin<RoleInstance, RoleId, UserRoleAttributes>;
                                                              // addRole...
                                                              // createRole...
                                                              // removeRole...
                                                              // removeRoles...
                                                              // hasRole...
                                                              // hasRoles...
                                                              // countRoles...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (
                                                            newAssociations?: Array<TInstance | TInstancePrimaryKey>,
                                                            options?:
                                                            | BelongsToManyAddAssociationsMixinOptions
                                                            | AnyFindOptions
                                                            | BulkCreateOptions
                                                            | InstanceUpdateOptions
                                                            | InstanceDestroyOptions
                                                            | { through: TJoinTableAttributes }
                                                            ): Promise<void>;
                                                            • Associate several instances with this.

                                                              Parameter newAssociations

                                                              An array of instances or primary key of instances to associate with this.

                                                              Parameter options

                                                              The options passed to through.findAll, bulkCreate, update and destroy. Can also hold additional attributes for the join table.

                                                            interface BelongsToManyAddAssociationsMixinOptions

                                                            interface BelongsToManyAddAssociationsMixinOptions {}
                                                            • The options for the addAssociations mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManyAddAssociationsMixin

                                                            property validate

                                                            validate?: boolean | undefined;
                                                            • Run validation for the join model.

                                                            interface BelongsToManyCountAssociationsMixin

                                                            interface BelongsToManyCountAssociationsMixin {}
                                                            • The countAssociations mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRoles...
                                                              // setRoles...
                                                              // addRoles...
                                                              // addRole...
                                                              // createRole...
                                                              // removeRole...
                                                              // removeRoles...
                                                              // hasRole...
                                                              // hasRoles...
                                                              countRoles: Sequelize.BelongsToManyCountAssociationsMixin;
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (options?: BelongsToManyCountAssociationsMixinOptions): Promise<number>;
                                                            • Count everything currently associated with this, using an optional where clause.

                                                              Parameter options

                                                              The options to use when counting the associations.

                                                            interface BelongsToManyCountAssociationsMixinOptions

                                                            interface BelongsToManyCountAssociationsMixinOptions {}
                                                            • The options for the countAssociations mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManyCountAssociationsMixin

                                                            property scope

                                                            scope?: string | boolean | undefined;
                                                            • Apply a scope on the related model, or remove its default scope by passing false.

                                                            property where

                                                            where?: AnyWhereOptions | undefined;
                                                            • An optional where clause to limit the associated models.

                                                            interface BelongsToManyCreateAssociationMixin

                                                            interface BelongsToManyCreateAssociationMixin<
                                                            TAttributes,
                                                            TInstance,
                                                            TJoinTableAttributes
                                                            > {}
                                                            • The createAssociation mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRoles...
                                                              // setRoles...
                                                              // addRoles...
                                                              // addRole...
                                                              createRole: Sequelize.BelongsToManyCreateAssociationMixin<RoleAttributes, UserRoleAttributes>;
                                                              // removeRole...
                                                              // removeRoles...
                                                              // hasRole...
                                                              // hasRoles...
                                                              // countRoles...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (
                                                            values?: TAttributes,
                                                            options?:
                                                            | BelongsToManyCreateAssociationMixinOptions
                                                            | CreateOptions
                                                            | { through: TJoinTableAttributes }
                                                            ): Promise<TInstance>;
                                                            • Create a new instance of the associated model and associate it with this.

                                                              Parameter values

                                                              The values used to create the association.

                                                              Parameter options

                                                              Options passed to create and add. Can also hold additional attributes for the join table.

                                                            interface BelongsToManyCreateAssociationMixinOptions

                                                            interface BelongsToManyCreateAssociationMixinOptions {}
                                                            • The options for the createAssociation mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManyCreateAssociationMixin

                                                            interface BelongsToManyGetAssociationsMixin

                                                            interface BelongsToManyGetAssociationsMixin<TInstance> {}
                                                            • The getAssociations mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              getRoles: Sequelize.BelongsToManyGetAssociationsMixin<RoleInstance>;
                                                              // setRoles...
                                                              // addRoles...
                                                              // addRole...
                                                              // createRole...
                                                              // removeRole...
                                                              // removeRoles...
                                                              // hasRole...
                                                              // hasRoles...
                                                              // countRoles...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (options?: BelongsToManyGetAssociationsMixinOptions): Promise<TInstance[]>;
                                                            • Get everything currently associated with this, using an optional where clause.

                                                              Parameter options

                                                              The options to use when getting the associations.

                                                            interface BelongsToManyGetAssociationsMixinOptions

                                                            interface BelongsToManyGetAssociationsMixinOptions {}
                                                            • The options for the getAssociations mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManyGetAssociationsMixin

                                                            property scope

                                                            scope?: string | boolean | undefined;
                                                            • Apply a scope on the related model, or remove its default scope by passing false.

                                                            property where

                                                            where?: AnyWhereOptions | undefined;
                                                            • An optional where clause to limit the associated models.

                                                            interface BelongsToManyHasAssociationMixin

                                                            interface BelongsToManyHasAssociationMixin<TInstance, TInstancePrimaryKey> {}
                                                            • The hasAssociation mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRoles...
                                                              // setRoles...
                                                              // addRoles...
                                                              // addRole...
                                                              // createRole...
                                                              // removeRole...
                                                              // removeRoles...
                                                              hasRole: Sequelize.BelongsToManyHasAssociationMixin<RoleInstance, RoleId>;
                                                              // hasRoles...
                                                              // countRoles...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (
                                                            target: TInstance | TInstancePrimaryKey,
                                                            options?:
                                                            | BelongsToManyHasAssociationMixinOptions
                                                            | BelongsToManyGetAssociationsMixinOptions
                                                            ): Promise<boolean>;
                                                            • Check if an instance is associated with this.

                                                              Parameter target

                                                              The instance or the primary key of the instance to check.

                                                              Parameter options

                                                              The options passed to getAssociations.

                                                            interface BelongsToManyHasAssociationMixinOptions

                                                            interface BelongsToManyHasAssociationMixinOptions {}
                                                            • The options for the hasAssociation mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManyHasAssociationMixin

                                                            interface BelongsToManyHasAssociationsMixin

                                                            interface BelongsToManyHasAssociationsMixin<TInstance, TInstancePrimaryKey> {}
                                                            • The removeAssociations mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRoles...
                                                              // setRoles...
                                                              // addRoles...
                                                              // addRole...
                                                              // createRole...
                                                              // removeRole...
                                                              // removeRoles
                                                              // hasRole...
                                                              hasRoles: Sequelize.BelongsToManyHasAssociationsMixin<RoleInstance, RoleId>;
                                                              // countRoles...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (
                                                            targets: Array<TInstance | TInstancePrimaryKey>,
                                                            options?:
                                                            | BelongsToManyHasAssociationsMixinOptions
                                                            | BelongsToManyGetAssociationsMixinOptions
                                                            ): Promise<boolean>;
                                                            • Check if all instances are associated with this.

                                                              Parameter targets

                                                              An array of instances or primary key of instances to check.

                                                              Parameter options

                                                              The options passed to getAssociations.

                                                            interface BelongsToManyHasAssociationsMixinOptions

                                                            interface BelongsToManyHasAssociationsMixinOptions {}
                                                            • The options for the hasAssociations mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManyHasAssociationsMixin

                                                            interface BelongsToManyRemoveAssociationMixin

                                                            interface BelongsToManyRemoveAssociationMixin<TInstance, TInstancePrimaryKey> {}
                                                            • The removeAssociation mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRoles...
                                                              // setRoles...
                                                              // addRoles...
                                                              // addRole...
                                                              // createRole...
                                                              removeRole: Sequelize.BelongsToManyRemoveAssociationMixin<RoleInstance, RoleId>;
                                                              // removeRoles...
                                                              // hasRole...
                                                              // hasRoles...
                                                              // countRoles...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (
                                                            oldAssociated?: TInstance | TInstancePrimaryKey,
                                                            options?: BelongsToManyRemoveAssociationMixinOptions | InstanceDestroyOptions
                                                            ): Promise<void>;
                                                            • Un-associate the instance.

                                                              Parameter oldAssociated

                                                              The instance or the primary key of the instance to un-associate.

                                                              Parameter options

                                                              The options passed to through.destroy.

                                                            interface BelongsToManyRemoveAssociationMixinOptions

                                                            interface BelongsToManyRemoveAssociationMixinOptions {}
                                                            • The options for the removeAssociation mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManyRemoveAssociationMixin

                                                            interface BelongsToManyRemoveAssociationsMixin

                                                            interface BelongsToManyRemoveAssociationsMixin<TInstance, TInstancePrimaryKey> {}
                                                            • The removeAssociations mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRoles...
                                                              // setRoles...
                                                              // addRoles...
                                                              // addRole...
                                                              // createRole...
                                                              // removeRole...
                                                              removeRoles: Sequelize.BelongsToManyRemoveAssociationsMixin<RoleInstance, RoleId>;
                                                              // hasRole...
                                                              // hasRoles...
                                                              // countRoles...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (
                                                            oldAssociateds?: Array<TInstance | TInstancePrimaryKey>,
                                                            options?:
                                                            | BelongsToManyRemoveAssociationsMixinOptions
                                                            | InstanceDestroyOptions
                                                            ): Promise<void>;
                                                            • Un-associate several instances.

                                                              Parameter oldAssociated

                                                              An array of instances or primary key of instances to un-associate.

                                                              Parameter options

                                                              The options passed to through.destroy.

                                                            interface BelongsToManyRemoveAssociationsMixinOptions

                                                            interface BelongsToManyRemoveAssociationsMixinOptions {}
                                                            • The options for the removeAssociations mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManyRemoveAssociationsMixin

                                                            interface BelongsToManySetAssociationsMixin

                                                            interface BelongsToManySetAssociationsMixin<
                                                            TInstance,
                                                            TInstancePrimaryKey,
                                                            TJoinTableAttributes
                                                            > {}
                                                            • The setAssociations mixin applied to models with belongsToMany. An example of usage is as follows:

                                                              User.belongsToMany(Role, { through: UserRole });
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRoles...
                                                              setRoles: Sequelize.BelongsToManySetAssociationsMixin<RoleInstance, RoleId, UserRoleAttributes>;
                                                              // addRoles...
                                                              // addRole...
                                                              // createRole...
                                                              // removeRole...
                                                              // removeRoles...
                                                              // hasRole...
                                                              // hasRoles...
                                                              // countRoles...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

                                                              • Instance

                                                            call signature

                                                            (
                                                            newAssociations?: Array<TInstance | TInstancePrimaryKey>,
                                                            options?:
                                                            | BelongsToManySetAssociationsMixinOptions
                                                            | AnyFindOptions
                                                            | BulkCreateOptions
                                                            | InstanceUpdateOptions
                                                            | InstanceDestroyOptions
                                                            | { through: TJoinTableAttributes }
                                                            ): Promise<void>;
                                                            • Set the associated models by passing an array of instances or their primary keys. Everything that it not in the passed array will be un-associated.

                                                              Parameter newAssociations

                                                              An array of instances or primary key of instances to associate with this. Pass null or undefined to remove all associations.

                                                              Parameter options

                                                              The options passed to through.findAll, bulkCreate, update and destroy. Can also hold additional attributes for the join table.

                                                            interface BelongsToManySetAssociationsMixinOptions

                                                            interface BelongsToManySetAssociationsMixinOptions {}
                                                            • The options for the setAssociations mixin of the belongsToMany association.

                                                              See Also

                                                              • BelongsToManySetAssociationsMixin

                                                            property validate

                                                            validate?: boolean | undefined;
                                                            • Run validation for the join model.

                                                            interface BelongsToSetAssociationMixin

                                                            interface BelongsToSetAssociationMixin<TInstance, TInstancePrimaryKey> {}
                                                            • The setAssociation mixin applied to models with belongsTo. An example of usage is as follows:

                                                              User.belongsTo(Role);
                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                              // getRole...
                                                              setRole: Sequelize.BelongsToSetAssociationMixin<RoleInstance, RoleId>;
                                                              // createRole...
                                                              }

                                                              See Also

                                                              • http://docs.sequelizejs.com/en/latest/api/associations/belongs-to/

                                                              • Instance

                                                            call signature

                                                            (
                                                            newAssociation?: TInstance | TInstancePrimaryKey,
                                                            options?: BelongsToSetAssociationMixinOptions | InstanceSaveOptions
                                                            ): Promise<void>;
                                                            • Set the associated instance.

                                                              Parameter newAssociation

                                                              An instance or the primary key of an instance to associate with this. Pass null or undefined to remove the association.

                                                              Parameter options

                                                              the options passed to this.save.

                                                            interface BelongsToSetAssociationMixinOptions

                                                            interface BelongsToSetAssociationMixinOptions {}
                                                            • The options for the setAssociation mixin of the belongsTo association.

                                                              See Also

                                                              • BelongsToSetAssociationMixin

                                                            property save

                                                            save?: boolean | undefined;
                                                            • Skip saving this after setting the foreign key if false.

                                                            interface BuildOptions

                                                            interface BuildOptions extends ReturningOptions {}
                                                            • Options for Model.build method

                                                            property include

                                                            include?: Array<Model<any, any> | IncludeOptions> | undefined;
                                                            • an array of include options - Used to build prefetched/included model instances. See set

                                                              TODO: See set

                                                            property isNewRecord

                                                            isNewRecord?: boolean | undefined;
                                                            • Is this record new

                                                            property raw

                                                            raw?: boolean | undefined;
                                                            • If set to true, values will ignore field and virtual setters.

                                                            interface BulkCreateOptions

                                                            interface BulkCreateOptions
                                                            extends FieldsOptions,
                                                            LoggingOptions,
                                                            SearchPathOptions,
                                                            ReturningOptions {}
                                                            • Options for Model.bulkCreate method

                                                            property hooks

                                                            hooks?: boolean | undefined;
                                                            • Run before / after bulk create hooks?

                                                            property ignoreDuplicates

                                                            ignoreDuplicates?: boolean | undefined;
                                                            • Ignore duplicate values for primary keys? (not supported by postgres)

                                                              Defaults to false

                                                            property individualHooks

                                                            individualHooks?: boolean | undefined;
                                                            • Run before / after create hooks for each individual Instance? BulkCreate hooks will still be run if options.hooks is true.

                                                            property updateOnDuplicate

                                                            updateOnDuplicate?: string[] | undefined;
                                                            • Fields to update if row key already exists (on duplicate key update)? (only supported by mysql & mariadb). By default, all fields are updated.

                                                            interface cast

                                                            interface cast {}

                                                              property type

                                                              type: string;

                                                                property val

                                                                val: any;

                                                                  interface castStatic

                                                                  interface castStatic {}

                                                                    construct signature

                                                                    new (val: any, type: string): cast;
                                                                    • Creates a object representing a call to the cast function.

                                                                      Parameter val

                                                                      The value to cast

                                                                      Parameter type

                                                                      The type to cast it to

                                                                    interface col

                                                                    interface col {}

                                                                      property col

                                                                      col: string;

                                                                        interface colStatic

                                                                        interface colStatic {}

                                                                          construct signature

                                                                          new (col: string): col;
                                                                          • Creates a object representing a column in the DB. This is often useful in conjunction with sequelize.fn, since raw string arguments to fn will be escaped.

                                                                            Parameter col

                                                                            The name of the column

                                                                            See Also

                                                                            • {Sequelize#fn}

                                                                          interface ColumnOptions

                                                                          interface ColumnOptions {}
                                                                          • General column options

                                                                            See Also

                                                                            • Define

                                                                            • AssociationForeignKeyOptions

                                                                          property allowNull

                                                                          allowNull?: boolean | undefined;
                                                                          • If false, the column will have a NOT NULL constraint, and a not null validation will be run before an instance is saved.

                                                                          property defaultValue

                                                                          defaultValue?: any;
                                                                          • A literal default value, a JavaScript function, or an SQL function (see sequelize.fn)

                                                                          property field

                                                                          field?: string | undefined;
                                                                          • If set, sequelize will map the attribute name to a different name in the database

                                                                          interface ConnectionError

                                                                          interface ConnectionError extends BaseError {}

                                                                            construct signature

                                                                            new (parent: Error): ConnectionError;
                                                                            • A base class for all connection related errors.

                                                                            interface ConnectionRefusedError

                                                                            interface ConnectionRefusedError extends ConnectionError {}

                                                                              construct signature

                                                                              new (parent: Error): ConnectionRefusedError;
                                                                              • Thrown when a connection to a database is refused

                                                                              interface ConnectionTimedOutError

                                                                              interface ConnectionTimedOutError extends ConnectionError {}

                                                                                construct signature

                                                                                new (parent: Error): ConnectionTimedOutError;
                                                                                • Thrown when a connection to a database times out

                                                                                interface CountOptions

                                                                                interface CountOptions extends LoggingOptions, SearchPathOptions {}
                                                                                • Options for Model.count method

                                                                                property attributes

                                                                                attributes?: Array<string | [string, string]> | undefined;
                                                                                • Used in conjustion with group

                                                                                property col

                                                                                col?: string | undefined;
                                                                                • Apply column on which COUNT() should be applied

                                                                                property distinct

                                                                                distinct?: boolean | undefined;
                                                                                • Apply COUNT(DISTINCT(col))

                                                                                property group

                                                                                group?: Object | undefined;
                                                                                • For creating complex counts. Will return multiple rows as needed.

                                                                                  TODO: Check?

                                                                                property include

                                                                                include?:
                                                                                | Array<Model<any, any> | IncludeOptions>
                                                                                | Model<any, any>
                                                                                | IncludeOptions
                                                                                | undefined;
                                                                                • Include options. See find for details

                                                                                property where

                                                                                where?: AnyWhereOptions | string[] | undefined;
                                                                                • A hash of search attributes.

                                                                                interface CreateOptions

                                                                                interface CreateOptions extends BuildOptions, InstanceSaveOptions {}
                                                                                • Options for Model.create method

                                                                                property onDuplicate

                                                                                onDuplicate?: string | undefined;
                                                                                • On Duplicate

                                                                                interface DatabaseError

                                                                                interface DatabaseError extends BaseError {}

                                                                                  construct signature

                                                                                  new (parent: Error): DatabaseError;
                                                                                  • A base class for all database related errors.

                                                                                  interface DataTypeAbstract

                                                                                  interface DataTypeAbstract {}
                                                                                  • Abstract DataType interface. Use this if you want to create an interface that has a value any of the DataTypes that Sequelize supports.

                                                                                  property dialectTypes

                                                                                  dialectTypes: string;
                                                                                  • Although this is not needed for the definitions itself, we want to make sure that DataTypeAbstract is not something than can be evaluated to an empty object.

                                                                                  interface DataTypeAbstractNumber

                                                                                  interface DataTypeAbstractNumber<T> extends DataTypeAbstract {}

                                                                                    property UNSIGNED

                                                                                    UNSIGNED: T;

                                                                                      property ZEROFILL

                                                                                      ZEROFILL: T;

                                                                                        interface DataTypeAbstractString

                                                                                        interface DataTypeAbstractString<T> extends DataTypeAbstract {}

                                                                                          property BINARY

                                                                                          BINARY: T;
                                                                                          • Property BINARY for the type

                                                                                          call signature

                                                                                          (options?: { length: number }): T;
                                                                                          • A variable length string. Default length 255

                                                                                          call signature

                                                                                          (length: number): T;

                                                                                            interface DataTypeAbstractUUID

                                                                                            interface DataTypeAbstractUUID<T> extends DataTypeAbstract {}

                                                                                              interface DataTypeArray

                                                                                              interface DataTypeArray extends DataTypeAbstract {}

                                                                                                call signature

                                                                                                (options: { type: DataTypeAbstract }): DataTypeArray;
                                                                                                • Array field for Postgre

                                                                                                  Accepts type any of the DataTypes

                                                                                                call signature

                                                                                                (type: DataTypeAbstract): DataTypeArray;

                                                                                                  interface DataTypeBigInt

                                                                                                  interface DataTypeBigInt extends DataTypeAbstractNumber<DataTypeBigInt> {}

                                                                                                    call signature

                                                                                                    (options?: { length: number }): DataTypeBigInt;
                                                                                                    • Length of the number field.

                                                                                                    call signature

                                                                                                    (length: number): DataTypeBigInt;

                                                                                                      interface DataTypeBlob

                                                                                                      interface DataTypeBlob extends DataTypeAbstract {}

                                                                                                        call signature

                                                                                                        (options?: { length: string }): DataTypeBlob;
                                                                                                        • Length of the blob field.

                                                                                                          Available lengths: tiny, medium, long

                                                                                                        call signature

                                                                                                        (length: string): DataTypeBlob;

                                                                                                          interface DataTypeBoolean

                                                                                                          interface DataTypeBoolean extends DataTypeAbstract {}

                                                                                                            interface DataTypeChar

                                                                                                            interface DataTypeChar extends DataTypeAbstractString<DataTypeChar> {}

                                                                                                              interface DataTypeDate

                                                                                                              interface DataTypeDate extends DataTypeAbstract {}

                                                                                                                call signature

                                                                                                                (options?: { length?: number | undefined }): DataTypeDate;
                                                                                                                • Length of decimal places of time

                                                                                                                call signature

                                                                                                                (length?: number): DataTypeDate;

                                                                                                                  interface DataTypeDateOnly

                                                                                                                  interface DataTypeDateOnly extends DataTypeAbstract {}

                                                                                                                    interface DataTypeDecimal

                                                                                                                    interface DataTypeDecimal extends DataTypeAbstractNumber<DataTypeDecimal> {}

                                                                                                                      call signature

                                                                                                                      (options?: { precision: number; scale?: number | undefined }): DataTypeDecimal;
                                                                                                                      • Precision and scale for the decimal number

                                                                                                                      call signature

                                                                                                                      (precision: number, scale?: number): DataTypeDecimal;

                                                                                                                        interface DataTypeDouble

                                                                                                                        interface DataTypeDouble extends DataTypeAbstractNumber<DataTypeDouble> {}

                                                                                                                          call signature

                                                                                                                          (options?: { length: number; decimals?: number | undefined }): DataTypeDouble;
                                                                                                                          • Length of the number field and decimals of the real

                                                                                                                          call signature

                                                                                                                          (length: number, decimals?: number): DataTypeDouble;

                                                                                                                            interface DataTypeEnum

                                                                                                                            interface DataTypeEnum extends DataTypeAbstract {}

                                                                                                                              call signature

                                                                                                                              (options?: { values: string | string[] }): DataTypeEnum;
                                                                                                                              • Enum field

                                                                                                                                Accepts values

                                                                                                                              call signature

                                                                                                                              (values: string | string[]): DataTypeEnum;

                                                                                                                                call signature

                                                                                                                                (...args: string[]): DataTypeEnum;

                                                                                                                                  interface DataTypeFloat

                                                                                                                                  interface DataTypeFloat extends DataTypeAbstractNumber<DataTypeFloat> {}

                                                                                                                                    call signature

                                                                                                                                    (options?: { length: number; decimals?: number | undefined }): DataTypeFloat;
                                                                                                                                    • Length of the number field and decimals of the float

                                                                                                                                    call signature

                                                                                                                                    (length: number, decimals?: number): DataTypeFloat;

                                                                                                                                      interface DataTypeGeometry

                                                                                                                                      interface DataTypeGeometry extends DataTypeAbstract {}

                                                                                                                                        call signature

                                                                                                                                        (type: string, srid?: number): DataTypeGeometry;
                                                                                                                                        • Geometry field for Postgres

                                                                                                                                        interface DataTypeHStore

                                                                                                                                        interface DataTypeHStore extends DataTypeAbstract {}

                                                                                                                                          interface DataTypeInteger

                                                                                                                                          interface DataTypeInteger extends DataTypeAbstractNumber<DataTypeInteger> {}

                                                                                                                                            call signature

                                                                                                                                            (options?: { length: number }): DataTypeInteger;
                                                                                                                                            • Length of the number field.

                                                                                                                                            call signature

                                                                                                                                            (length: number): DataTypeInteger;

                                                                                                                                              interface DataTypeJSONB

                                                                                                                                              interface DataTypeJSONB extends DataTypeAbstract {}

                                                                                                                                                interface DataTypeJSONType

                                                                                                                                                interface DataTypeJSONType extends DataTypeAbstract {}

                                                                                                                                                  interface DataTypeMediumInt

                                                                                                                                                  interface DataTypeMediumInt extends DataTypeAbstractNumber<DataTypeMediumInt> {}

                                                                                                                                                    call signature

                                                                                                                                                    (options?: { length: number }): DataTypeMediumInt;
                                                                                                                                                    • Length of the number field.

                                                                                                                                                    call signature

                                                                                                                                                    (length: number): DataTypeMediumInt;

                                                                                                                                                      interface DataTypeNow

                                                                                                                                                      interface DataTypeNow extends DataTypeAbstract {}

                                                                                                                                                        interface DataTypeNumber

                                                                                                                                                        interface DataTypeNumber extends DataTypeAbstractNumber<DataTypeNumber> {}

                                                                                                                                                          interface DataTypeRange

                                                                                                                                                          interface DataTypeRange extends DataTypeAbstract {}

                                                                                                                                                            call signature

                                                                                                                                                            (options?: { subtype: DataTypeAbstract }): DataTypeRange;
                                                                                                                                                            • Range field for Postgre

                                                                                                                                                              Accepts subtype any of the ranges

                                                                                                                                                            call signature

                                                                                                                                                            (subtype: DataTypeAbstract): DataTypeRange;

                                                                                                                                                              interface DataTypeReal

                                                                                                                                                              interface DataTypeReal extends DataTypeAbstractNumber<DataTypeReal> {}

                                                                                                                                                                call signature

                                                                                                                                                                (options?: { length: number; decimals?: number | undefined }): DataTypeReal;
                                                                                                                                                                • Length of the number field and decimals of the real

                                                                                                                                                                call signature

                                                                                                                                                                (length: number, decimals?: number): DataTypeReal;

                                                                                                                                                                  interface DataTypes

                                                                                                                                                                  interface DataTypes {}
                                                                                                                                                                  • A convenience class holding commonly used data types. The datatypes are used when definining a new model using Sequelize.define, like this:

                                                                                                                                                                    sequelize.define('model', {
                                                                                                                                                                    column: DataTypes.INTEGER
                                                                                                                                                                    })

                                                                                                                                                                    When defining a model you can just as easily pass a string as type, but often using the types defined here is beneficial. For example, using DataTypes.BLOB, mean that that column will be returned as an instance of Buffer when being fetched by sequelize.

                                                                                                                                                                    Some data types have special properties that can be accessed in order to change the data type. For example, to get an unsigned integer with zerofill you can do DataTypes.INTEGER.UNSIGNED.ZEROFILL. The order you access the properties in do not matter, so DataTypes.INTEGER.ZEROFILL.UNSIGNED is fine as well. The available properties are listed under each data type.

                                                                                                                                                                    To provide a length for the data type, you can invoke it like a function: INTEGER(2)

                                                                                                                                                                    Three of the values provided here (NOW, UUIDV1 and UUIDV4) are special default values, that should not be used to define types. Instead they are used as shorthands for defining default values. For example, to get a uuid field with a default value generated following v1 of the UUID standard:

                                                                                                                                                                    sequelize.define('model', {
                                                                                                                                                                    uuid: {
                                                                                                                                                                    type: DataTypes.UUID,
                                                                                                                                                                    defaultValue: DataTypes.UUIDV1,
                                                                                                                                                                    primaryKey: true
                                                                                                                                                                    }
                                                                                                                                                                    })

                                                                                                                                                                  property "DOUBLE PRECISION"

                                                                                                                                                                  'DOUBLE PRECISION': DataTypeDouble;

                                                                                                                                                                    property ABSTRACT

                                                                                                                                                                    ABSTRACT: DataTypeAbstract;

                                                                                                                                                                      property ARRAY

                                                                                                                                                                      ARRAY: DataTypeArray;

                                                                                                                                                                        property BIGINT

                                                                                                                                                                        BIGINT: DataTypeBigInt;

                                                                                                                                                                          property BLOB

                                                                                                                                                                          BLOB: DataTypeBlob;

                                                                                                                                                                            property BOOLEAN

                                                                                                                                                                            BOOLEAN: DataTypeBoolean;

                                                                                                                                                                              property CHAR

                                                                                                                                                                              CHAR: DataTypeChar;

                                                                                                                                                                                property DATE

                                                                                                                                                                                DATE: DataTypeDate;

                                                                                                                                                                                  property DATEONLY

                                                                                                                                                                                  DATEONLY: DataTypeDateOnly;

                                                                                                                                                                                    property DECIMAL

                                                                                                                                                                                    DECIMAL: DataTypeDecimal;

                                                                                                                                                                                      property DOUBLE

                                                                                                                                                                                      DOUBLE: DataTypeDouble;

                                                                                                                                                                                        property ENUM

                                                                                                                                                                                        ENUM: DataTypeEnum;

                                                                                                                                                                                          property FLOAT

                                                                                                                                                                                          FLOAT: DataTypeFloat;

                                                                                                                                                                                            property GEOMETRY

                                                                                                                                                                                            GEOMETRY: DataTypeGeometry;

                                                                                                                                                                                              property HSTORE

                                                                                                                                                                                              HSTORE: DataTypeHStore;

                                                                                                                                                                                                property INTEGER

                                                                                                                                                                                                INTEGER: DataTypeInteger;

                                                                                                                                                                                                  property JSON

                                                                                                                                                                                                  JSON: DataTypeJSONType;

                                                                                                                                                                                                    property JSONB

                                                                                                                                                                                                    JSONB: DataTypeJSONB;

                                                                                                                                                                                                      property MEDIUMINT

                                                                                                                                                                                                      MEDIUMINT: DataTypeMediumInt;

                                                                                                                                                                                                        property NONE

                                                                                                                                                                                                        NONE: DataTypeVirtual;

                                                                                                                                                                                                          property NOW

                                                                                                                                                                                                          NOW: DataTypeNow;

                                                                                                                                                                                                            property NUMBER

                                                                                                                                                                                                            NUMBER: DataTypeNumber;

                                                                                                                                                                                                              property NUMERIC

                                                                                                                                                                                                              NUMERIC: DataTypeDecimal;

                                                                                                                                                                                                                property RANGE

                                                                                                                                                                                                                RANGE: DataTypeRange;

                                                                                                                                                                                                                  property REAL

                                                                                                                                                                                                                  REAL: DataTypeReal;

                                                                                                                                                                                                                    property SMALLINT

                                                                                                                                                                                                                    SMALLINT: DataTypeSmallInt;

                                                                                                                                                                                                                      property STRING

                                                                                                                                                                                                                      STRING: DataTypeString;

                                                                                                                                                                                                                        property TEXT

                                                                                                                                                                                                                        TEXT: DataTypeText;

                                                                                                                                                                                                                          property TIME

                                                                                                                                                                                                                          TIME: DataTypeTime;

                                                                                                                                                                                                                            property TINYINT

                                                                                                                                                                                                                            TINYINT: DataTypeTinyInt;

                                                                                                                                                                                                                              property UUID

                                                                                                                                                                                                                              UUID: DataTypeUUID;

                                                                                                                                                                                                                                property UUIDV1

                                                                                                                                                                                                                                UUIDV1: DataTypeUUIDv1;

                                                                                                                                                                                                                                  property UUIDV4

                                                                                                                                                                                                                                  UUIDV4: DataTypeUUIDv4;

                                                                                                                                                                                                                                    property VIRTUAL

                                                                                                                                                                                                                                    VIRTUAL: DataTypeVirtual;

                                                                                                                                                                                                                                      interface DataTypeSmallInt

                                                                                                                                                                                                                                      interface DataTypeSmallInt extends DataTypeAbstractNumber<DataTypeSmallInt> {}

                                                                                                                                                                                                                                        call signature

                                                                                                                                                                                                                                        (options?: { length: number }): DataTypeSmallInt;
                                                                                                                                                                                                                                        • Length of the number field.

                                                                                                                                                                                                                                        call signature

                                                                                                                                                                                                                                        (length: number): DataTypeSmallInt;

                                                                                                                                                                                                                                          interface DataTypeString

                                                                                                                                                                                                                                          interface DataTypeString extends DataTypeAbstractString<DataTypeString> {}

                                                                                                                                                                                                                                            interface DataTypeText

                                                                                                                                                                                                                                            interface DataTypeText extends DataTypeAbstract {}

                                                                                                                                                                                                                                              call signature

                                                                                                                                                                                                                                              (options?: { length: string }): DataTypeText;
                                                                                                                                                                                                                                              • Length of the text field.

                                                                                                                                                                                                                                                Available lengths: tiny, medium, long

                                                                                                                                                                                                                                              call signature

                                                                                                                                                                                                                                              (length: string): DataTypeText;

                                                                                                                                                                                                                                                interface DataTypeTime

                                                                                                                                                                                                                                                interface DataTypeTime extends DataTypeAbstract {}

                                                                                                                                                                                                                                                  interface DataTypeTinyInt

                                                                                                                                                                                                                                                  interface DataTypeTinyInt extends DataTypeAbstractNumber<DataTypeTinyInt> {}

                                                                                                                                                                                                                                                    call signature

                                                                                                                                                                                                                                                    (options?: { length: number }): DataTypeTinyInt;
                                                                                                                                                                                                                                                    • Length of the number field.

                                                                                                                                                                                                                                                    call signature

                                                                                                                                                                                                                                                    (length: number): DataTypeTinyInt;

                                                                                                                                                                                                                                                      interface DataTypeUUID

                                                                                                                                                                                                                                                      interface DataTypeUUID extends DataTypeAbstractUUID<DataTypeUUID> {}

                                                                                                                                                                                                                                                        interface DataTypeUUIDv1

                                                                                                                                                                                                                                                        interface DataTypeUUIDv1 extends DataTypeAbstractUUID<DataTypeUUIDv1> {}

                                                                                                                                                                                                                                                          interface DataTypeUUIDv4

                                                                                                                                                                                                                                                          interface DataTypeUUIDv4 extends DataTypeAbstractUUID<DataTypeUUIDv4> {}

                                                                                                                                                                                                                                                            interface DataTypeVirtual

                                                                                                                                                                                                                                                            interface DataTypeVirtual extends DataTypeAbstract {}

                                                                                                                                                                                                                                                              construct signature

                                                                                                                                                                                                                                                              new (subtype: DataTypeAbstract, requireAttributes?: string[]): DataTypeVirtual;
                                                                                                                                                                                                                                                              • Virtual field

                                                                                                                                                                                                                                                                Accepts subtype any of the DataTypes Array of required attributes that are available on the model

                                                                                                                                                                                                                                                              interface Deferrable

                                                                                                                                                                                                                                                              interface Deferrable {}
                                                                                                                                                                                                                                                              • A collection of properties related to deferrable constraints. It can be used to make foreign key constraints deferrable and to set the constaints within a transaction. This is only supported in PostgreSQL.

                                                                                                                                                                                                                                                                The foreign keys can be configured like this. It will create a foreign key that will check the constraints immediately when the data was inserted.

                                                                                                                                                                                                                                                                sequelize.define('Model', {
                                                                                                                                                                                                                                                                foreign_id: {
                                                                                                                                                                                                                                                                type: Sequelize.INTEGER,
                                                                                                                                                                                                                                                                references: {
                                                                                                                                                                                                                                                                model: OtherModel,
                                                                                                                                                                                                                                                                key: 'id',
                                                                                                                                                                                                                                                                deferrable: Sequelize.Deferrable.INITIALLY_IMMEDIATE
                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                });

                                                                                                                                                                                                                                                                The constraints can be configured in a transaction like this. It will trigger a query once the transaction has been started and set the constraints to be checked at the very end of the transaction.

                                                                                                                                                                                                                                                                sequelize.transaction({
                                                                                                                                                                                                                                                                deferrable: Sequelize.Deferrable.SET_DEFERRED
                                                                                                                                                                                                                                                                });

                                                                                                                                                                                                                                                              property INITIALLY_DEFERRED

                                                                                                                                                                                                                                                              INITIALLY_DEFERRED: DeferrableInitiallyDeferred;

                                                                                                                                                                                                                                                                property INITIALLY_IMMEDIATE

                                                                                                                                                                                                                                                                INITIALLY_IMMEDIATE: DeferrableInitiallyImmediate;

                                                                                                                                                                                                                                                                  property NOT

                                                                                                                                                                                                                                                                  NOT: DeferrableNot;

                                                                                                                                                                                                                                                                    property SET_DEFERRED

                                                                                                                                                                                                                                                                    SET_DEFERRED: DeferrableSetDeferred;

                                                                                                                                                                                                                                                                      property SET_IMMEDIATE

                                                                                                                                                                                                                                                                      SET_IMMEDIATE: DeferrableSetImmediate;

                                                                                                                                                                                                                                                                        interface DeferrableAbstract

                                                                                                                                                                                                                                                                        interface DeferrableAbstract {}
                                                                                                                                                                                                                                                                        • Abstract Deferrable interface. Use this if you want to create an interface that has a value any of the Deferrables that Sequelize supports.

                                                                                                                                                                                                                                                                        method toSql

                                                                                                                                                                                                                                                                        toSql: () => string;

                                                                                                                                                                                                                                                                          method toString

                                                                                                                                                                                                                                                                          toString: () => string;
                                                                                                                                                                                                                                                                          • Although this is not needed for the definitions itself, we want to make sure that DeferrableAbstract is not something than can be evaluated to an empty object.

                                                                                                                                                                                                                                                                          interface DeferrableInitiallyDeferred

                                                                                                                                                                                                                                                                          interface DeferrableInitiallyDeferred extends DeferrableAbstract {}

                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                            (): DeferrableInitiallyDeferred;
                                                                                                                                                                                                                                                                            • A property that will defer constraints checks to the end of transactions.

                                                                                                                                                                                                                                                                            interface DeferrableInitiallyImmediate

                                                                                                                                                                                                                                                                            interface DeferrableInitiallyImmediate extends DeferrableAbstract {}

                                                                                                                                                                                                                                                                              call signature

                                                                                                                                                                                                                                                                              (): DeferrableInitiallyImmediate;
                                                                                                                                                                                                                                                                              • A property that will trigger the constraint checks immediately

                                                                                                                                                                                                                                                                              interface DeferrableNot

                                                                                                                                                                                                                                                                              interface DeferrableNot extends DeferrableAbstract {}

                                                                                                                                                                                                                                                                                call signature

                                                                                                                                                                                                                                                                                (): DeferrableNot;
                                                                                                                                                                                                                                                                                • A property that will set the constraints to not deferred. This is the default in PostgreSQL and it make it impossible to dynamically defer the constraints within a transaction.

                                                                                                                                                                                                                                                                                interface DeferrableSetDeferred

                                                                                                                                                                                                                                                                                interface DeferrableSetDeferred extends DeferrableAbstract {}

                                                                                                                                                                                                                                                                                  call signature

                                                                                                                                                                                                                                                                                  (constraints: string[]): DeferrableSetDeferred;
                                                                                                                                                                                                                                                                                  • A property that will trigger an additional query at the beginning of a transaction which sets the constraints to deferred.

                                                                                                                                                                                                                                                                                    Parameter constraints

                                                                                                                                                                                                                                                                                    An array of constraint names. Will defer all constraints by default.

                                                                                                                                                                                                                                                                                  interface DeferrableSetImmediate

                                                                                                                                                                                                                                                                                  interface DeferrableSetImmediate extends DeferrableAbstract {}

                                                                                                                                                                                                                                                                                    call signature

                                                                                                                                                                                                                                                                                    (constraints: string[]): DeferrableSetImmediate;
                                                                                                                                                                                                                                                                                    • A property that will trigger an additional query at the beginning of a transaction which sets the constraints to immediately.

                                                                                                                                                                                                                                                                                      Parameter constraints

                                                                                                                                                                                                                                                                                      An array of constraint names. Will defer all constraints by default.

                                                                                                                                                                                                                                                                                    interface DefineAttributeColumnOptions

                                                                                                                                                                                                                                                                                    interface DefineAttributeColumnOptions extends ColumnOptions {}
                                                                                                                                                                                                                                                                                    • Column options for the model schema attributes

                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                      • Attributes

                                                                                                                                                                                                                                                                                    property autoIncrement

                                                                                                                                                                                                                                                                                    autoIncrement?: boolean | undefined;
                                                                                                                                                                                                                                                                                    • Is this field an auto increment field

                                                                                                                                                                                                                                                                                    property comment

                                                                                                                                                                                                                                                                                    comment?: string | undefined;
                                                                                                                                                                                                                                                                                    • Comment for the database

                                                                                                                                                                                                                                                                                    property get

                                                                                                                                                                                                                                                                                    get?: (() => any) | undefined;
                                                                                                                                                                                                                                                                                    • Provide a custom getter for this column. Use this.getDataValue(String) to manipulate the underlying values.

                                                                                                                                                                                                                                                                                    property onDelete

                                                                                                                                                                                                                                                                                    onDelete?: string | undefined;
                                                                                                                                                                                                                                                                                    • What should happen when the referenced key is deleted. One of CASCADE, RESTRICT, SET DEFAULT, SET NULL or NO ACTION

                                                                                                                                                                                                                                                                                    property onUpdate

                                                                                                                                                                                                                                                                                    onUpdate?: string | undefined;
                                                                                                                                                                                                                                                                                    • What should happen when the referenced key is updated. One of CASCADE, RESTRICT, SET DEFAULT, SET NULL or NO ACTION

                                                                                                                                                                                                                                                                                    property primaryKey

                                                                                                                                                                                                                                                                                    primaryKey?: boolean | undefined;
                                                                                                                                                                                                                                                                                    • Primary key flag

                                                                                                                                                                                                                                                                                    property references

                                                                                                                                                                                                                                                                                    references?: DefineAttributeColumnReferencesOptions | undefined;
                                                                                                                                                                                                                                                                                    • An object with reference configurations

                                                                                                                                                                                                                                                                                    property set

                                                                                                                                                                                                                                                                                    set?: ((val: any) => void) | undefined;
                                                                                                                                                                                                                                                                                    • Provide a custom setter for this column. Use this.setDataValue(String, Value) to manipulate the underlying values.

                                                                                                                                                                                                                                                                                    property type

                                                                                                                                                                                                                                                                                    type: string | DataTypeAbstract;
                                                                                                                                                                                                                                                                                    • A string or a data type

                                                                                                                                                                                                                                                                                    property unique

                                                                                                                                                                                                                                                                                    unique?: boolean | string | { name: string; msg: string } | undefined;
                                                                                                                                                                                                                                                                                    • If true, the column will get a unique constraint. If a string is provided, the column will be part of a composite unique index. If multiple columns have the same string, they will be part of the same unique index

                                                                                                                                                                                                                                                                                    property validate

                                                                                                                                                                                                                                                                                    validate?: DefineValidateOptions | undefined;
                                                                                                                                                                                                                                                                                    • An object of validations to execute for this column every time the model is saved. Can be either the name of a validation provided by validator.js, a validation function provided by extending validator.js (see the DAOValidator property for more details), or a custom validation function. Custom validation functions are called with the value of the field, and can possibly take a second callback argument, to signal that they are asynchronous. If the validator is sync, it should throw in the case of a failed validation, it it is async, the callback should be called with the error text.

                                                                                                                                                                                                                                                                                    property values

                                                                                                                                                                                                                                                                                    values?: string[] | undefined;
                                                                                                                                                                                                                                                                                    • Usage in object notation

                                                                                                                                                                                                                                                                                      sequelize.define('model', {
                                                                                                                                                                                                                                                                                      states: {
                                                                                                                                                                                                                                                                                      type: Sequelize.ENUM,
                                                                                                                                                                                                                                                                                      values: ['active', 'pending', 'deleted']
                                                                                                                                                                                                                                                                                      }
                                                                                                                                                                                                                                                                                      })

                                                                                                                                                                                                                                                                                    interface DefineAttributeColumnReferencesOptions

                                                                                                                                                                                                                                                                                    interface DefineAttributeColumnReferencesOptions {}
                                                                                                                                                                                                                                                                                    • References options for the column's attributes

                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                      • AttributeColumnOptions

                                                                                                                                                                                                                                                                                    property deferrable

                                                                                                                                                                                                                                                                                    deferrable?:
                                                                                                                                                                                                                                                                                    | DeferrableInitiallyDeferred
                                                                                                                                                                                                                                                                                    | DeferrableInitiallyImmediate
                                                                                                                                                                                                                                                                                    | DeferrableNot
                                                                                                                                                                                                                                                                                    | DeferrableSetDeferred
                                                                                                                                                                                                                                                                                    | DeferrableSetImmediate
                                                                                                                                                                                                                                                                                    | undefined;
                                                                                                                                                                                                                                                                                    • When to check for the foreign key constraing

                                                                                                                                                                                                                                                                                      PostgreSQL only

                                                                                                                                                                                                                                                                                    property key

                                                                                                                                                                                                                                                                                    key?: string | undefined;
                                                                                                                                                                                                                                                                                    • The column of the foreign table that this column references

                                                                                                                                                                                                                                                                                    property model

                                                                                                                                                                                                                                                                                    model: string | Model<any, any>;
                                                                                                                                                                                                                                                                                    • If this column references another table, provide it here as a Model, or a string

                                                                                                                                                                                                                                                                                    interface DefineAttributes

                                                                                                                                                                                                                                                                                    interface DefineAttributes {}
                                                                                                                                                                                                                                                                                    • Interface for Attributes provided for a column

                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                      • Sequelize.define

                                                                                                                                                                                                                                                                                    index signature

                                                                                                                                                                                                                                                                                    [name: string]: string | DataTypeAbstract | DefineAttributeColumnOptions;
                                                                                                                                                                                                                                                                                    • The description of a database column

                                                                                                                                                                                                                                                                                    interface DefineGetterMethodsOptions

                                                                                                                                                                                                                                                                                    interface DefineGetterMethodsOptions {}
                                                                                                                                                                                                                                                                                    • Interface for getterMethods in DefineOptions

                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                      • DefineOptions

                                                                                                                                                                                                                                                                                    index signature

                                                                                                                                                                                                                                                                                    [name: string]: () => any;

                                                                                                                                                                                                                                                                                      interface DefineIndexesOptions

                                                                                                                                                                                                                                                                                      interface DefineIndexesOptions {}
                                                                                                                                                                                                                                                                                      • Interface for indexes property in DefineOptions

                                                                                                                                                                                                                                                                                        See Also

                                                                                                                                                                                                                                                                                        • DefineOptions

                                                                                                                                                                                                                                                                                      property concurrently

                                                                                                                                                                                                                                                                                      concurrently?: boolean | undefined;
                                                                                                                                                                                                                                                                                      • PostgreSQL will build the index without taking any write locks. Postgres only

                                                                                                                                                                                                                                                                                        Defaults to false

                                                                                                                                                                                                                                                                                      property fields

                                                                                                                                                                                                                                                                                      fields?:
                                                                                                                                                                                                                                                                                      | Array<
                                                                                                                                                                                                                                                                                      | string
                                                                                                                                                                                                                                                                                      | fn
                                                                                                                                                                                                                                                                                      | { attribute: string; length: number; order: string; collate: string }
                                                                                                                                                                                                                                                                                      >
                                                                                                                                                                                                                                                                                      | undefined;
                                                                                                                                                                                                                                                                                      • An array of the fields to index. Each field can either be a string containing the name of the field, a sequelize object (e.g sequelize.fn), or an object with the following attributes: attribute (field name), length (create a prefix index of length chars), order (the direction the column should be sorted in), collate (the collation (sort order) for the column)

                                                                                                                                                                                                                                                                                      property method

                                                                                                                                                                                                                                                                                      method?: string | undefined;
                                                                                                                                                                                                                                                                                      • The method to create the index by (USING statement in SQL). BTREE and HASH are supported by mysql and postgres, and postgres additionally supports GIST and GIN.

                                                                                                                                                                                                                                                                                      property name

                                                                                                                                                                                                                                                                                      name?: string | undefined;
                                                                                                                                                                                                                                                                                      • The name of the index. Defaults to model name + _ + fields concatenated

                                                                                                                                                                                                                                                                                      property operator

                                                                                                                                                                                                                                                                                      operator?: string | undefined;
                                                                                                                                                                                                                                                                                      • Operator that should be used by gin index, see Built-in GIN Operator Classes

                                                                                                                                                                                                                                                                                      property type

                                                                                                                                                                                                                                                                                      type?: IndexType | undefined;
                                                                                                                                                                                                                                                                                      • Index type. Only used by mysql. One of UNIQUE, FULLTEXT and SPATIAL

                                                                                                                                                                                                                                                                                      property unique

                                                                                                                                                                                                                                                                                      unique?: boolean | undefined;
                                                                                                                                                                                                                                                                                      • Should the index by unique? Can also be triggered by setting type to UNIQUE

                                                                                                                                                                                                                                                                                        Defaults to false

                                                                                                                                                                                                                                                                                      property using

                                                                                                                                                                                                                                                                                      using?: string | undefined;
                                                                                                                                                                                                                                                                                      • Method the index should use, for example 'gin' index.

                                                                                                                                                                                                                                                                                      property where

                                                                                                                                                                                                                                                                                      where?: AnyWhereOptions | undefined;
                                                                                                                                                                                                                                                                                      • Condition for partioal index

                                                                                                                                                                                                                                                                                      interface DefineIndexOptions

                                                                                                                                                                                                                                                                                      interface DefineIndexOptions {}

                                                                                                                                                                                                                                                                                        property concurrently

                                                                                                                                                                                                                                                                                        concurrently?: boolean | undefined;
                                                                                                                                                                                                                                                                                        • Pass CONCURRENT so other operations run while the index is created - PostgresSQL only. Default is false

                                                                                                                                                                                                                                                                                        property indexName

                                                                                                                                                                                                                                                                                        indexName?: string | undefined;
                                                                                                                                                                                                                                                                                        • The name of the index. Default is __

                                                                                                                                                                                                                                                                                        property indexType

                                                                                                                                                                                                                                                                                        indexType?: string | undefined;
                                                                                                                                                                                                                                                                                        • Set a type for the index, e.g. BTREE. See the documentation of the used dialect

                                                                                                                                                                                                                                                                                        property indicesType

                                                                                                                                                                                                                                                                                        indicesType?: IndexType | undefined;
                                                                                                                                                                                                                                                                                        • The index type

                                                                                                                                                                                                                                                                                        property logging

                                                                                                                                                                                                                                                                                        logging?: Function | undefined;
                                                                                                                                                                                                                                                                                        • A function that receives the sql query, e.g. console.log

                                                                                                                                                                                                                                                                                        property name

                                                                                                                                                                                                                                                                                        name?: string | undefined;
                                                                                                                                                                                                                                                                                        • The name of the index. Default is Default is __

                                                                                                                                                                                                                                                                                        property operator

                                                                                                                                                                                                                                                                                        operator?: string | undefined;
                                                                                                                                                                                                                                                                                        • Index operator

                                                                                                                                                                                                                                                                                        property parser

                                                                                                                                                                                                                                                                                        parser?: string | undefined;
                                                                                                                                                                                                                                                                                        • For FULLTEXT columns set your parser

                                                                                                                                                                                                                                                                                        property type

                                                                                                                                                                                                                                                                                        type?: IndexType | undefined;
                                                                                                                                                                                                                                                                                        • The index type

                                                                                                                                                                                                                                                                                        property unique

                                                                                                                                                                                                                                                                                        unique?: boolean | undefined;
                                                                                                                                                                                                                                                                                        • Create a unique index

                                                                                                                                                                                                                                                                                        property using

                                                                                                                                                                                                                                                                                        using?: string | undefined;
                                                                                                                                                                                                                                                                                        • Create an unique index

                                                                                                                                                                                                                                                                                        property where

                                                                                                                                                                                                                                                                                        where?: AnyWhereOptions | undefined;
                                                                                                                                                                                                                                                                                        • A hash of attributes to limit your index(Filtered Indexes - MSSQL & PostgreSQL only)

                                                                                                                                                                                                                                                                                        interface DefineNameOptions

                                                                                                                                                                                                                                                                                        interface DefineNameOptions {}
                                                                                                                                                                                                                                                                                        • Interface for name property in DefineOptions

                                                                                                                                                                                                                                                                                          See Also

                                                                                                                                                                                                                                                                                          • DefineOptions

                                                                                                                                                                                                                                                                                        property plural

                                                                                                                                                                                                                                                                                        plural?: string | undefined;
                                                                                                                                                                                                                                                                                        • Plural model name

                                                                                                                                                                                                                                                                                        property singular

                                                                                                                                                                                                                                                                                        singular?: string | undefined;
                                                                                                                                                                                                                                                                                        • Singular model name

                                                                                                                                                                                                                                                                                        interface DefineOptions

                                                                                                                                                                                                                                                                                        interface DefineOptions<TInstance> {}
                                                                                                                                                                                                                                                                                        • Options for model definition

                                                                                                                                                                                                                                                                                          See Also

                                                                                                                                                                                                                                                                                          • Sequelize.define

                                                                                                                                                                                                                                                                                        property charset

                                                                                                                                                                                                                                                                                        charset?: string | undefined;

                                                                                                                                                                                                                                                                                          property classMethods

                                                                                                                                                                                                                                                                                          classMethods?: Object | undefined;
                                                                                                                                                                                                                                                                                          • Provide functions that are added to the model (Model). If you override methods provided by sequelize, you can access the original method using this.constructor.prototype, e.g. this.constructor.prototype.find.apply(this, arguments)

                                                                                                                                                                                                                                                                                          property collate

                                                                                                                                                                                                                                                                                          collate?: string | undefined;

                                                                                                                                                                                                                                                                                            property comment

                                                                                                                                                                                                                                                                                            comment?: string | undefined;
                                                                                                                                                                                                                                                                                            • Finaly you can specify a comment for the table in MySQL and PG

                                                                                                                                                                                                                                                                                            property createdAt

                                                                                                                                                                                                                                                                                            createdAt?: string | boolean | undefined;
                                                                                                                                                                                                                                                                                            • Override 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.

                                                                                                                                                                                                                                                                                            property defaultScope

                                                                                                                                                                                                                                                                                            defaultScope?: AnyFindOptions | undefined;
                                                                                                                                                                                                                                                                                            • Define the default search scope to use for this model. Scopes have the same form as the options passed to find / findAll.

                                                                                                                                                                                                                                                                                            property deletedAt

                                                                                                                                                                                                                                                                                            deletedAt?: string | boolean | undefined;
                                                                                                                                                                                                                                                                                            • Override 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.

                                                                                                                                                                                                                                                                                            property engine

                                                                                                                                                                                                                                                                                            engine?: string | undefined;
                                                                                                                                                                                                                                                                                            • You can also change the database engine, e.g. to MyISAM. InnoDB is the default.

                                                                                                                                                                                                                                                                                            property freezeTableName

                                                                                                                                                                                                                                                                                            freezeTableName?: boolean | undefined;
                                                                                                                                                                                                                                                                                            • If 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.

                                                                                                                                                                                                                                                                                            property getterMethods

                                                                                                                                                                                                                                                                                            getterMethods?: DefineGetterMethodsOptions | undefined;
                                                                                                                                                                                                                                                                                            • Provide getter functions that work like those defined per column. If you provide a getter method with the same name as a column, it will be used to access the value of that column. If you provide a name that does not match a column, this function will act as a virtual getter, that can fetch multiple other values

                                                                                                                                                                                                                                                                                            property hasTrigger

                                                                                                                                                                                                                                                                                            hasTrigger?: boolean | undefined;
                                                                                                                                                                                                                                                                                            • Indicates if the model's table has a trigger associated with it. Default false.

                                                                                                                                                                                                                                                                                            property hooks

                                                                                                                                                                                                                                                                                            hooks?: HooksDefineOptions<TInstance> | undefined;
                                                                                                                                                                                                                                                                                            • An object of hook function that are called before and after certain lifecycle events. The possible hooks are: beforeValidate, afterValidate, beforeBulkCreate, beforeBulkDestroy, beforeBulkUpdate, beforeCreate, beforeDestroy, beforeSave, beforeUpdate, afterCreate, afterDestroy, afterSave, afterUpdate, afterBulkCreate, afterBulkDestory and afterBulkUpdate. See Hooks for more information about hook functions and their signatures. Each property can either be a function, or an array of functions.

                                                                                                                                                                                                                                                                                            property indexes

                                                                                                                                                                                                                                                                                            indexes?: DefineIndexesOptions[] | undefined;
                                                                                                                                                                                                                                                                                            • Indexes for the provided database table

                                                                                                                                                                                                                                                                                            property initialAutoIncrement

                                                                                                                                                                                                                                                                                            initialAutoIncrement?: string | undefined;
                                                                                                                                                                                                                                                                                            • Set the initial AUTO_INCREMENT value for the table in MySQL.

                                                                                                                                                                                                                                                                                            property instanceMethods

                                                                                                                                                                                                                                                                                            instanceMethods?: Object | undefined;
                                                                                                                                                                                                                                                                                            • Provide functions that are added to each instance (DAO). If you override methods provided by sequelize, you can access the original method using this.constructor.super_.prototype, e.g. this.constructor.super_.prototype.toJSON.apply(this, arguments)

                                                                                                                                                                                                                                                                                            property name

                                                                                                                                                                                                                                                                                            name?: DefineNameOptions | undefined;
                                                                                                                                                                                                                                                                                            • An object with two attributes, singular and plural, which are used when this model is associated to others.

                                                                                                                                                                                                                                                                                            property omitNull

                                                                                                                                                                                                                                                                                            omitNull?: boolean | undefined;
                                                                                                                                                                                                                                                                                            • Don't persits null values. This means that all columns with null values will not be saved.

                                                                                                                                                                                                                                                                                            property paranoid

                                                                                                                                                                                                                                                                                            paranoid?: boolean | undefined;
                                                                                                                                                                                                                                                                                            • Calling destroy will not delete the model, but instead set a deletedAt timestamp if this is true. Needs timestamps=true to work. Default false.

                                                                                                                                                                                                                                                                                            property rejectOnError

                                                                                                                                                                                                                                                                                            rejectOnError?: boolean | Error | undefined;
                                                                                                                                                                                                                                                                                            • Throws an error when no records found

                                                                                                                                                                                                                                                                                            property rowFormat

                                                                                                                                                                                                                                                                                            rowFormat?: string | undefined;
                                                                                                                                                                                                                                                                                            • Specify the ROW_FORMAT for use with the MySQL InnoDB engine.

                                                                                                                                                                                                                                                                                            property schema

                                                                                                                                                                                                                                                                                            schema?: string | undefined;
                                                                                                                                                                                                                                                                                            • Change the database schema. PG only feature, but also works with other dialects.

                                                                                                                                                                                                                                                                                            property schemaDelimiter

                                                                                                                                                                                                                                                                                            schemaDelimiter?: string | undefined;
                                                                                                                                                                                                                                                                                            • Change the database schema delimiter. Defaults to "." on PG but for other dialects can be also changed to "_".

                                                                                                                                                                                                                                                                                            property scopes

                                                                                                                                                                                                                                                                                            scopes?: DefineScopeOptions | undefined;
                                                                                                                                                                                                                                                                                            • More 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

                                                                                                                                                                                                                                                                                            property setterMethods

                                                                                                                                                                                                                                                                                            setterMethods?: DefineSetterMethodsOptions | undefined;
                                                                                                                                                                                                                                                                                            • Provide setter functions that work like those defined per column. If you provide a setter method with the same name as a column, it will be used to update the value of that column. If you provide a name that does not match a column, this function will act as a virtual setter, that can act on and set other values, but will not be persisted

                                                                                                                                                                                                                                                                                            property tableName

                                                                                                                                                                                                                                                                                            tableName?: string | undefined;
                                                                                                                                                                                                                                                                                            • Defaults to pluralized model name, unless freezeTableName is true, in which case it uses model name verbatim

                                                                                                                                                                                                                                                                                            property timestamps

                                                                                                                                                                                                                                                                                            timestamps?: boolean | undefined;
                                                                                                                                                                                                                                                                                            • Adds createdAt and updatedAt timestamps to the model. Default true.

                                                                                                                                                                                                                                                                                            property underscored

                                                                                                                                                                                                                                                                                            underscored?: boolean | undefined;
                                                                                                                                                                                                                                                                                            • Converts all camelCased columns to underscored if true. Default false.

                                                                                                                                                                                                                                                                                            property underscoredAll

                                                                                                                                                                                                                                                                                            underscoredAll?: boolean | undefined;
                                                                                                                                                                                                                                                                                            • Converts camelCased model names to underscored tablenames if true. Default false.

                                                                                                                                                                                                                                                                                            property updatedAt

                                                                                                                                                                                                                                                                                            updatedAt?: string | boolean | undefined;
                                                                                                                                                                                                                                                                                            • Override 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.

                                                                                                                                                                                                                                                                                            property validate

                                                                                                                                                                                                                                                                                            validate?: DefineValidateOptions | undefined;
                                                                                                                                                                                                                                                                                            • An 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.

                                                                                                                                                                                                                                                                                            property version

                                                                                                                                                                                                                                                                                            version?: boolean | string | undefined;
                                                                                                                                                                                                                                                                                            • Enable 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.

                                                                                                                                                                                                                                                                                            interface DefineScopeOptions

                                                                                                                                                                                                                                                                                            interface DefineScopeOptions {}
                                                                                                                                                                                                                                                                                            • Interface for Define Scope Options

                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                              • DefineOptions

                                                                                                                                                                                                                                                                                            index signature

                                                                                                                                                                                                                                                                                            [scopeName: string]: AnyFindOptions | Function;
                                                                                                                                                                                                                                                                                            • Name of the scope and it's query

                                                                                                                                                                                                                                                                                            interface DefineSetterMethodsOptions

                                                                                                                                                                                                                                                                                            interface DefineSetterMethodsOptions {}
                                                                                                                                                                                                                                                                                            • Interface for setterMethods in DefineOptions

                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                              • DefineOptions

                                                                                                                                                                                                                                                                                            index signature

                                                                                                                                                                                                                                                                                            [name: string]: (val: any) => void;

                                                                                                                                                                                                                                                                                              interface DefineValidateOptions

                                                                                                                                                                                                                                                                                              interface DefineValidateOptions {}
                                                                                                                                                                                                                                                                                              • Model validations, allow you to specify format/content/inheritance validations for each attribute of the model.

                                                                                                                                                                                                                                                                                                Validations are automatically run on create, update and save. You can also call validate() to manually validate an instance.

                                                                                                                                                                                                                                                                                                The validations are implemented by validator.js.

                                                                                                                                                                                                                                                                                              property contains

                                                                                                                                                                                                                                                                                              contains?: string | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • force specific substrings

                                                                                                                                                                                                                                                                                              property equals

                                                                                                                                                                                                                                                                                              equals?: string | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • only allow a specific value

                                                                                                                                                                                                                                                                                              property is

                                                                                                                                                                                                                                                                                              is?:
                                                                                                                                                                                                                                                                                              | string
                                                                                                                                                                                                                                                                                              | Array<string | RegExp>
                                                                                                                                                                                                                                                                                              | RegExp
                                                                                                                                                                                                                                                                                              | { msg: string; args: string | Array<string | RegExp> | RegExp }
                                                                                                                                                                                                                                                                                              | undefined;
                                                                                                                                                                                                                                                                                              • is: ["^[a-z]+$",'i'] // will only allow letters is: /^[a-z]+$/i // same as the previous example using real RegExp

                                                                                                                                                                                                                                                                                              property isAfter

                                                                                                                                                                                                                                                                                              isAfter?: string | { msg: string; args: string } | undefined;
                                                                                                                                                                                                                                                                                              • only allow date strings after a specific date

                                                                                                                                                                                                                                                                                              property isAlpha

                                                                                                                                                                                                                                                                                              isAlpha?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • will only allow letters

                                                                                                                                                                                                                                                                                              property isAlphanumeric

                                                                                                                                                                                                                                                                                              isAlphanumeric?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • will only allow alphanumeric characters, so "_abc" will fail

                                                                                                                                                                                                                                                                                              property isArray

                                                                                                                                                                                                                                                                                              isArray?: boolean | { msg: string; args: boolean } | undefined;
                                                                                                                                                                                                                                                                                              • only allow arrays

                                                                                                                                                                                                                                                                                              property isBefore

                                                                                                                                                                                                                                                                                              isBefore?: string | { msg: string; args: string } | undefined;
                                                                                                                                                                                                                                                                                              • only allow date strings before a specific date

                                                                                                                                                                                                                                                                                              property isCreditCard

                                                                                                                                                                                                                                                                                              isCreditCard?: boolean | { msg: string; args: boolean } | undefined;
                                                                                                                                                                                                                                                                                              • check for valid credit card numbers

                                                                                                                                                                                                                                                                                              property isDate

                                                                                                                                                                                                                                                                                              isDate?: boolean | { msg: string; args: boolean } | undefined;
                                                                                                                                                                                                                                                                                              • only allow date strings

                                                                                                                                                                                                                                                                                              property isDecimal

                                                                                                                                                                                                                                                                                              isDecimal?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for any numbers

                                                                                                                                                                                                                                                                                              property isEmail

                                                                                                                                                                                                                                                                                              isEmail?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for email format (foo@bar.com)

                                                                                                                                                                                                                                                                                              property isFloat

                                                                                                                                                                                                                                                                                              isFloat?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for valid floating point numbers

                                                                                                                                                                                                                                                                                              property isIn

                                                                                                                                                                                                                                                                                              isIn?: string[][] | { msg: string; args: string[][] } | undefined;
                                                                                                                                                                                                                                                                                              • check the value is one of these

                                                                                                                                                                                                                                                                                              property isInt

                                                                                                                                                                                                                                                                                              isInt?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for valid integers

                                                                                                                                                                                                                                                                                              property isIP

                                                                                                                                                                                                                                                                                              isIP?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for IPv4 (129.89.23.1) or IPv6 format

                                                                                                                                                                                                                                                                                              property isIPv4

                                                                                                                                                                                                                                                                                              isIPv4?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for IPv4 (129.89.23.1)

                                                                                                                                                                                                                                                                                              property isIPv6

                                                                                                                                                                                                                                                                                              isIPv6?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for IPv6 format

                                                                                                                                                                                                                                                                                              property isLowercase

                                                                                                                                                                                                                                                                                              isLowercase?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for lowercase

                                                                                                                                                                                                                                                                                              property isNull

                                                                                                                                                                                                                                                                                              isNull?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • only allows null

                                                                                                                                                                                                                                                                                              property isNumeric

                                                                                                                                                                                                                                                                                              isNumeric?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • will only allow numbers

                                                                                                                                                                                                                                                                                              property isUppercase

                                                                                                                                                                                                                                                                                              isUppercase?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for uppercase

                                                                                                                                                                                                                                                                                              property isUrl

                                                                                                                                                                                                                                                                                              isUrl?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • checks for url format (http://foo.com)

                                                                                                                                                                                                                                                                                              property isUUID

                                                                                                                                                                                                                                                                                              isUUID?:
                                                                                                                                                                                                                                                                                              | 3
                                                                                                                                                                                                                                                                                              | 4
                                                                                                                                                                                                                                                                                              | 5
                                                                                                                                                                                                                                                                                              | '3'
                                                                                                                                                                                                                                                                                              | '4'
                                                                                                                                                                                                                                                                                              | '5'
                                                                                                                                                                                                                                                                                              | 'all'
                                                                                                                                                                                                                                                                                              | { msg: string; args: number }
                                                                                                                                                                                                                                                                                              | undefined;
                                                                                                                                                                                                                                                                                              • only allow uuids

                                                                                                                                                                                                                                                                                              property len

                                                                                                                                                                                                                                                                                              len?: [number, number] | { msg: string; args: [number, number] } | undefined;
                                                                                                                                                                                                                                                                                              • only allow values with length between 2 and 10

                                                                                                                                                                                                                                                                                              property max

                                                                                                                                                                                                                                                                                              max?: number | { msg: string; args: number } | undefined;
                                                                                                                                                                                                                                                                                              • only allow values

                                                                                                                                                                                                                                                                                              property min

                                                                                                                                                                                                                                                                                              min?: number | { msg: string; args: number } | undefined;
                                                                                                                                                                                                                                                                                              • only allow values >= 23

                                                                                                                                                                                                                                                                                              property not

                                                                                                                                                                                                                                                                                              not?:
                                                                                                                                                                                                                                                                                              | string
                                                                                                                                                                                                                                                                                              | Array<string | RegExp>
                                                                                                                                                                                                                                                                                              | RegExp
                                                                                                                                                                                                                                                                                              | { msg: string; args: string | Array<string | RegExp> | RegExp }
                                                                                                                                                                                                                                                                                              | undefined;
                                                                                                                                                                                                                                                                                              • not: ["[a-z]",'i'] // will not allow letters

                                                                                                                                                                                                                                                                                              property notContains

                                                                                                                                                                                                                                                                                              notContains?:
                                                                                                                                                                                                                                                                                              | string[]
                                                                                                                                                                                                                                                                                              | string
                                                                                                                                                                                                                                                                                              | { msg: string; args: string[] | string }
                                                                                                                                                                                                                                                                                              | undefined;
                                                                                                                                                                                                                                                                                              • don't allow specific substrings

                                                                                                                                                                                                                                                                                              property notEmpty

                                                                                                                                                                                                                                                                                              notEmpty?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • don't allow empty strings

                                                                                                                                                                                                                                                                                              property notIn

                                                                                                                                                                                                                                                                                              notIn?: string[][] | { msg: string; args: string[][] } | undefined;
                                                                                                                                                                                                                                                                                              • check the value is not one of these

                                                                                                                                                                                                                                                                                              property notNull

                                                                                                                                                                                                                                                                                              notNull?: boolean | { msg: string } | undefined;
                                                                                                                                                                                                                                                                                              • won't allow null

                                                                                                                                                                                                                                                                                              index signature

                                                                                                                                                                                                                                                                                              [name: string]: any;
                                                                                                                                                                                                                                                                                              • custom validations are also possible

                                                                                                                                                                                                                                                                                                Implementation notes :

                                                                                                                                                                                                                                                                                                We can't enforce any other method to be a function, so :

                                                                                                                                                                                                                                                                                                [name: string] : ( value : any ) => boolean;

                                                                                                                                                                                                                                                                                                doesn't work in combination with the properties above

                                                                                                                                                                                                                                                                                                See Also

                                                                                                                                                                                                                                                                                                • https://github.com/Microsoft/TypeScript/issues/1889

                                                                                                                                                                                                                                                                                              interface DestroyOptions

                                                                                                                                                                                                                                                                                              interface DestroyOptions extends TruncateOptions {}
                                                                                                                                                                                                                                                                                              • Options used for Model.destroy

                                                                                                                                                                                                                                                                                              property force

                                                                                                                                                                                                                                                                                              force?: boolean | undefined;
                                                                                                                                                                                                                                                                                              • Delete instead of setting deletedAt to current timestamp (only applicable if paranoid is enabled)

                                                                                                                                                                                                                                                                                              property hooks

                                                                                                                                                                                                                                                                                              hooks?: boolean | undefined;
                                                                                                                                                                                                                                                                                              • Run before / after bulk destroy hooks?

                                                                                                                                                                                                                                                                                              property individualHooks

                                                                                                                                                                                                                                                                                              individualHooks?: boolean | undefined;
                                                                                                                                                                                                                                                                                              • If set to true, destroy will SELECT all records matching the where parameter and will execute before / after destroy hooks on each row

                                                                                                                                                                                                                                                                                              property limit

                                                                                                                                                                                                                                                                                              limit?: number | undefined;
                                                                                                                                                                                                                                                                                              • How many rows to delete

                                                                                                                                                                                                                                                                                              property truncate

                                                                                                                                                                                                                                                                                              truncate?: boolean | undefined;
                                                                                                                                                                                                                                                                                              • If set to true, dialects that support it will use TRUNCATE instead of DELETE FROM. If a table is truncated the where and limit options are ignored

                                                                                                                                                                                                                                                                                              property where

                                                                                                                                                                                                                                                                                              where?: AnyWhereOptions | undefined;
                                                                                                                                                                                                                                                                                              • Filter the destroy

                                                                                                                                                                                                                                                                                              interface DropOptions

                                                                                                                                                                                                                                                                                              interface DropOptions extends LoggingOptions {}
                                                                                                                                                                                                                                                                                              • Options to pass to Model on drop

                                                                                                                                                                                                                                                                                              property cascade

                                                                                                                                                                                                                                                                                              cascade?: boolean | undefined;
                                                                                                                                                                                                                                                                                              • Also drop all objects depending on this table, such as views. Only works in postgres

                                                                                                                                                                                                                                                                                              interface EmptyResultError

                                                                                                                                                                                                                                                                                              interface EmptyResultError extends BaseError {}

                                                                                                                                                                                                                                                                                                construct signature

                                                                                                                                                                                                                                                                                                new (parent: Error): EmptyResultError;
                                                                                                                                                                                                                                                                                                • Thrown when a record was not found, Usually used with rejectOnEmpty mode (see message for details)

                                                                                                                                                                                                                                                                                                interface Errors

                                                                                                                                                                                                                                                                                                interface Errors {}
                                                                                                                                                                                                                                                                                                • Sequelize provides a host of custom error classes, to allow you to do easier debugging. All of these errors are exposed on the sequelize object and the sequelize constructor. All sequelize errors inherit from the base JS error object.

                                                                                                                                                                                                                                                                                                property AccessDeniedError

                                                                                                                                                                                                                                                                                                AccessDeniedError: AccessDeniedError;

                                                                                                                                                                                                                                                                                                  property ConnectionError

                                                                                                                                                                                                                                                                                                  ConnectionError: ConnectionError;

                                                                                                                                                                                                                                                                                                    property ConnectionRefusedError

                                                                                                                                                                                                                                                                                                    ConnectionRefusedError: ConnectionRefusedError;

                                                                                                                                                                                                                                                                                                      property ConnectionTimedOutError

                                                                                                                                                                                                                                                                                                      ConnectionTimedOutError: ConnectionTimedOutError;

                                                                                                                                                                                                                                                                                                        property DatabaseError

                                                                                                                                                                                                                                                                                                        DatabaseError: DatabaseError;

                                                                                                                                                                                                                                                                                                          property EmptyResultError

                                                                                                                                                                                                                                                                                                          EmptyResultError: EmptyResultError;

                                                                                                                                                                                                                                                                                                            property Error

                                                                                                                                                                                                                                                                                                            Error: BaseError;

                                                                                                                                                                                                                                                                                                              property ExclusionConstraintError

                                                                                                                                                                                                                                                                                                              ExclusionConstraintError: ExclusionConstraintError;

                                                                                                                                                                                                                                                                                                                property ForeignKeyConstraintError

                                                                                                                                                                                                                                                                                                                ForeignKeyConstraintError: ForeignKeyConstraintError;

                                                                                                                                                                                                                                                                                                                  property HostNotFoundError

                                                                                                                                                                                                                                                                                                                  HostNotFoundError: HostNotFoundError;

                                                                                                                                                                                                                                                                                                                    property HostNotReachableError

                                                                                                                                                                                                                                                                                                                    HostNotReachableError: HostNotReachableError;

                                                                                                                                                                                                                                                                                                                      property InvalidConnectionError

                                                                                                                                                                                                                                                                                                                      InvalidConnectionError: InvalidConnectionError;

                                                                                                                                                                                                                                                                                                                        property TimeoutError

                                                                                                                                                                                                                                                                                                                        TimeoutError: TimeoutError;

                                                                                                                                                                                                                                                                                                                          property UniqueConstraintError

                                                                                                                                                                                                                                                                                                                          UniqueConstraintError: UniqueConstraintError;

                                                                                                                                                                                                                                                                                                                            property ValidationError

                                                                                                                                                                                                                                                                                                                            ValidationError: ValidationError;

                                                                                                                                                                                                                                                                                                                              property ValidationErrorItem

                                                                                                                                                                                                                                                                                                                              ValidationErrorItem: ValidationErrorItem;

                                                                                                                                                                                                                                                                                                                                interface ExclusionConstraintError

                                                                                                                                                                                                                                                                                                                                interface ExclusionConstraintError extends DatabaseError {}

                                                                                                                                                                                                                                                                                                                                  construct signature

                                                                                                                                                                                                                                                                                                                                  new (options: {
                                                                                                                                                                                                                                                                                                                                  parent?: Error | undefined;
                                                                                                                                                                                                                                                                                                                                  message?: string | undefined;
                                                                                                                                                                                                                                                                                                                                  constraint?: string | undefined;
                                                                                                                                                                                                                                                                                                                                  fields?: string[] | undefined;
                                                                                                                                                                                                                                                                                                                                  table?: string | undefined;
                                                                                                                                                                                                                                                                                                                                  }): ExclusionConstraintError;
                                                                                                                                                                                                                                                                                                                                  • Thrown when an exclusion constraint is violated in the database

                                                                                                                                                                                                                                                                                                                                  interface FieldsOptions

                                                                                                                                                                                                                                                                                                                                  interface FieldsOptions {}

                                                                                                                                                                                                                                                                                                                                    property fields

                                                                                                                                                                                                                                                                                                                                    fields?: string[] | undefined;
                                                                                                                                                                                                                                                                                                                                    • The fields to insert / update. Defaults to all fields

                                                                                                                                                                                                                                                                                                                                    property validate

                                                                                                                                                                                                                                                                                                                                    validate?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                    • Run validations before the row is inserted

                                                                                                                                                                                                                                                                                                                                    interface FindCreateFindOptions

                                                                                                                                                                                                                                                                                                                                    interface FindCreateFindOptions<TAttributes> extends FindOptions<TAttributes> {}
                                                                                                                                                                                                                                                                                                                                    • Options for Model.findOrInitialize method

                                                                                                                                                                                                                                                                                                                                    property defaults

                                                                                                                                                                                                                                                                                                                                    defaults?: TAttributes | undefined;
                                                                                                                                                                                                                                                                                                                                    • Default values to use if building a new instance

                                                                                                                                                                                                                                                                                                                                    interface FindOptions

                                                                                                                                                                                                                                                                                                                                    interface FindOptions<T> extends LoggingOptions, SearchPathOptions {}
                                                                                                                                                                                                                                                                                                                                    • Options that are passed to any model creating a SELECT query

                                                                                                                                                                                                                                                                                                                                      A hash of options to describe the scope of the search

                                                                                                                                                                                                                                                                                                                                    property attributes

                                                                                                                                                                                                                                                                                                                                    attributes?:
                                                                                                                                                                                                                                                                                                                                    | FindOptionsAttributesArray
                                                                                                                                                                                                                                                                                                                                    | {
                                                                                                                                                                                                                                                                                                                                    include?: FindOptionsAttributesArray | undefined;
                                                                                                                                                                                                                                                                                                                                    exclude?: string[] | undefined;
                                                                                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                                                                                    | undefined;
                                                                                                                                                                                                                                                                                                                                    • A list of the attributes that you want to select. To rename an attribute, you can pass an array, with two elements - the first is the name of the attribute in the DB (or some kind of expression such as Sequelize.literal, Sequelize.fn and so on), and the second is the name you want the attribute to have in the returned instance

                                                                                                                                                                                                                                                                                                                                    property distinct

                                                                                                                                                                                                                                                                                                                                    distinct?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                    • Apply DISTINCT(col) for FindAndCount(all)

                                                                                                                                                                                                                                                                                                                                    property group

                                                                                                                                                                                                                                                                                                                                    group?: string | string[] | Object | undefined;
                                                                                                                                                                                                                                                                                                                                    • Group by. It is not mentioned in sequelize's JSDoc, but mentioned in docs. https://github.com/sequelize/sequelize/blob/master/docs/docs/models-usage.md#user-content-manipulating-the-dataset-with-limit-offset-order-and-group

                                                                                                                                                                                                                                                                                                                                    property having

                                                                                                                                                                                                                                                                                                                                    having?: AnyWhereOptions | undefined;
                                                                                                                                                                                                                                                                                                                                    • having ?!?

                                                                                                                                                                                                                                                                                                                                    property include

                                                                                                                                                                                                                                                                                                                                    include?:
                                                                                                                                                                                                                                                                                                                                    | Array<Model<any, any> | IncludeOptions>
                                                                                                                                                                                                                                                                                                                                    | Model<any, any>
                                                                                                                                                                                                                                                                                                                                    | IncludeOptions
                                                                                                                                                                                                                                                                                                                                    | undefined;
                                                                                                                                                                                                                                                                                                                                    • A list of associations to eagerly load using a left join. Supported is either { include: [ Model1, Model2, ...]} or { include: [{ model: Model1, as: 'Alias' }]}. If your association are set up with an as (eg. X.hasMany(Y, { as: 'Z }, you need to specify Z in the as attribute when eager loading Y).

                                                                                                                                                                                                                                                                                                                                    property limit

                                                                                                                                                                                                                                                                                                                                    limit?: number | undefined;
                                                                                                                                                                                                                                                                                                                                    • Limit the results

                                                                                                                                                                                                                                                                                                                                    property lock

                                                                                                                                                                                                                                                                                                                                    lock?:
                                                                                                                                                                                                                                                                                                                                    | TransactionLockLevel
                                                                                                                                                                                                                                                                                                                                    | { level: TransactionLockLevel; of: Model<any, any> }
                                                                                                                                                                                                                                                                                                                                    | undefined;
                                                                                                                                                                                                                                                                                                                                    • Lock the selected rows. Possible options are transaction.LOCK.UPDATE and transaction.LOCK.SHARE. Postgres also supports transaction.LOCK.KEY_SHARE, transaction.LOCK.NO_KEY_UPDATE and specific model locks with joins. See [transaction.LOCK for an example](transaction#lock)

                                                                                                                                                                                                                                                                                                                                    property offset

                                                                                                                                                                                                                                                                                                                                    offset?: number | undefined;
                                                                                                                                                                                                                                                                                                                                    • Skip the results;

                                                                                                                                                                                                                                                                                                                                    property order

                                                                                                                                                                                                                                                                                                                                    order?:
                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                    | col
                                                                                                                                                                                                                                                                                                                                    | literal
                                                                                                                                                                                                                                                                                                                                    | FindOptionsOrderArray
                                                                                                                                                                                                                                                                                                                                    | fn
                                                                                                                                                                                                                                                                                                                                    | Array<string | col | literal | FindOptionsOrderArray | fn>
                                                                                                                                                                                                                                                                                                                                    | undefined;
                                                                                                                                                                                                                                                                                                                                    • Specifies an ordering. If a string is provided, it will be escaped. Using an array, you can provide several columns / functions to order by. Each element can be further wrapped in a two-element array. The first element is the column / function to order by, the second is the direction. For example: order: [['name', 'DESC']]. In this way the column will be escaped, but the direction will not.

                                                                                                                                                                                                                                                                                                                                    property paranoid

                                                                                                                                                                                                                                                                                                                                    paranoid?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                    • If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will be returned. Only applies if options.paranoid is true for the model.

                                                                                                                                                                                                                                                                                                                                    property raw

                                                                                                                                                                                                                                                                                                                                    raw?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                    • Return raw result. See sequelize.query for more information.

                                                                                                                                                                                                                                                                                                                                    property rejectOnEmpty

                                                                                                                                                                                                                                                                                                                                    rejectOnEmpty?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                    • Throw EmptyResultError if a record is not found

                                                                                                                                                                                                                                                                                                                                    property subQuery

                                                                                                                                                                                                                                                                                                                                    subQuery?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                    • Prevents a subquery on the main table when using include

                                                                                                                                                                                                                                                                                                                                    property useMaster

                                                                                                                                                                                                                                                                                                                                    useMaster?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                    • Force the query to use the write pool

                                                                                                                                                                                                                                                                                                                                      Defaults to false

                                                                                                                                                                                                                                                                                                                                    property where

                                                                                                                                                                                                                                                                                                                                    where?:
                                                                                                                                                                                                                                                                                                                                    | WhereOptions<T>
                                                                                                                                                                                                                                                                                                                                    | where
                                                                                                                                                                                                                                                                                                                                    | fn
                                                                                                                                                                                                                                                                                                                                    | Array<col | and | or | string>
                                                                                                                                                                                                                                                                                                                                    | undefined;
                                                                                                                                                                                                                                                                                                                                    • A hash of attributes to describe your search. See above for examples.

                                                                                                                                                                                                                                                                                                                                    interface FindOrInitializeOptions

                                                                                                                                                                                                                                                                                                                                    interface FindOrInitializeOptions<TAttributes> extends FindOptions<TAttributes> {}
                                                                                                                                                                                                                                                                                                                                    • Options for Model.findOrInitialize method

                                                                                                                                                                                                                                                                                                                                    property defaults

                                                                                                                                                                                                                                                                                                                                    defaults?: TAttributes | undefined;
                                                                                                                                                                                                                                                                                                                                    • Default values to use if building a new instance

                                                                                                                                                                                                                                                                                                                                    interface fn

                                                                                                                                                                                                                                                                                                                                    interface fn {}

                                                                                                                                                                                                                                                                                                                                      property clone

                                                                                                                                                                                                                                                                                                                                      clone: fnStatic;

                                                                                                                                                                                                                                                                                                                                        interface fnStatic

                                                                                                                                                                                                                                                                                                                                        interface fnStatic {}

                                                                                                                                                                                                                                                                                                                                          construct signature

                                                                                                                                                                                                                                                                                                                                          new (fn: string, ...args: any[]): fn;
                                                                                                                                                                                                                                                                                                                                          • Parameter fn

                                                                                                                                                                                                                                                                                                                                            The function you want to call

                                                                                                                                                                                                                                                                                                                                            Parameter args

                                                                                                                                                                                                                                                                                                                                            All further arguments will be passed as arguments to the function

                                                                                                                                                                                                                                                                                                                                          interface ForeignKeyConstraintError

                                                                                                                                                                                                                                                                                                                                          interface ForeignKeyConstraintError extends DatabaseError {}

                                                                                                                                                                                                                                                                                                                                            construct signature

                                                                                                                                                                                                                                                                                                                                            new (options: {
                                                                                                                                                                                                                                                                                                                                            parent?: Error | undefined;
                                                                                                                                                                                                                                                                                                                                            message?: string | undefined;
                                                                                                                                                                                                                                                                                                                                            index?: string | undefined;
                                                                                                                                                                                                                                                                                                                                            fields?: string[] | undefined;
                                                                                                                                                                                                                                                                                                                                            table?: string | undefined;
                                                                                                                                                                                                                                                                                                                                            }): ForeignKeyConstraintError;
                                                                                                                                                                                                                                                                                                                                            • Thrown when a foreign key constraint is violated in the database

                                                                                                                                                                                                                                                                                                                                            interface GetTableNameOptions

                                                                                                                                                                                                                                                                                                                                            interface GetTableNameOptions extends LoggingOptions {}
                                                                                                                                                                                                                                                                                                                                            • GetTableName Options

                                                                                                                                                                                                                                                                                                                                            interface HasManyAddAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyAddAssociationMixin<TInstance, TInstancePrimaryKey> {}
                                                                                                                                                                                                                                                                                                                                            • The addAssociation mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRoles...
                                                                                                                                                                                                                                                                                                                                              // setRoles...
                                                                                                                                                                                                                                                                                                                                              // addRoles...
                                                                                                                                                                                                                                                                                                                                              addRole: Sequelize.HasManyAddAssociationMixin<RoleInstance, RoleId>;
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              // removeRole...
                                                                                                                                                                                                                                                                                                                                              // removeRoles...
                                                                                                                                                                                                                                                                                                                                              // hasRole...
                                                                                                                                                                                                                                                                                                                                              // hasRoles...
                                                                                                                                                                                                                                                                                                                                              // countRoles...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            newAssociation?: TInstance | TInstancePrimaryKey,
                                                                                                                                                                                                                                                                                                                                            options?: HasManyAddAssociationMixinOptions | InstanceUpdateOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<void>;
                                                                                                                                                                                                                                                                                                                                            • Associate an instance with this.

                                                                                                                                                                                                                                                                                                                                              Parameter newAssociation

                                                                                                                                                                                                                                                                                                                                              An instance or the primary key of an instance to associate with this.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options passed to target.update.

                                                                                                                                                                                                                                                                                                                                            interface HasManyAddAssociationMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManyAddAssociationMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the addAssociation mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManyAddAssociationMixin

                                                                                                                                                                                                                                                                                                                                            property validate

                                                                                                                                                                                                                                                                                                                                            validate?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                            • Run validation for the join model.

                                                                                                                                                                                                                                                                                                                                            interface HasManyAddAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyAddAssociationsMixin<TInstance, TInstancePrimaryKey> {}
                                                                                                                                                                                                                                                                                                                                            • The addAssociations mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRoles...
                                                                                                                                                                                                                                                                                                                                              // setRoles...
                                                                                                                                                                                                                                                                                                                                              addRoles: Sequelize.HasManyAddAssociationsMixin<RoleInstance, RoleId>;
                                                                                                                                                                                                                                                                                                                                              // addRole...
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              // removeRole...
                                                                                                                                                                                                                                                                                                                                              // removeRoles...
                                                                                                                                                                                                                                                                                                                                              // hasRole...
                                                                                                                                                                                                                                                                                                                                              // hasRoles...
                                                                                                                                                                                                                                                                                                                                              // countRoles...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            newAssociations?: Array<TInstance | TInstancePrimaryKey>,
                                                                                                                                                                                                                                                                                                                                            options?: HasManyAddAssociationsMixinOptions | InstanceUpdateOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<void>;
                                                                                                                                                                                                                                                                                                                                            • Associate several instances with this.

                                                                                                                                                                                                                                                                                                                                              Parameter newAssociations

                                                                                                                                                                                                                                                                                                                                              An array of instances or primary key of instances to associate with this.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options passed to target.update.

                                                                                                                                                                                                                                                                                                                                            interface HasManyAddAssociationsMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManyAddAssociationsMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the addAssociations mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManyAddAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            property validate

                                                                                                                                                                                                                                                                                                                                            validate?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                            • Run validation for the join model.

                                                                                                                                                                                                                                                                                                                                            interface HasManyCountAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyCountAssociationsMixin {}
                                                                                                                                                                                                                                                                                                                                            • The countAssociations mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRoles...
                                                                                                                                                                                                                                                                                                                                              // setRoles...
                                                                                                                                                                                                                                                                                                                                              // addRoles...
                                                                                                                                                                                                                                                                                                                                              // addRole...
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              // removeRole...
                                                                                                                                                                                                                                                                                                                                              // removeRoles...
                                                                                                                                                                                                                                                                                                                                              // hasRole...
                                                                                                                                                                                                                                                                                                                                              // hasRoles...
                                                                                                                                                                                                                                                                                                                                              countRoles: Sequelize.HasManyCountAssociationsMixin;
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (options?: HasManyCountAssociationsMixinOptions): Promise<number>;
                                                                                                                                                                                                                                                                                                                                            • Count everything currently associated with this, using an optional where clause.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options to use when counting the associations.

                                                                                                                                                                                                                                                                                                                                            interface HasManyCountAssociationsMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManyCountAssociationsMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the countAssociations mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManyCountAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            property scope

                                                                                                                                                                                                                                                                                                                                            scope?: string | boolean | undefined;
                                                                                                                                                                                                                                                                                                                                            • Apply a scope on the related model, or remove its default scope by passing false.

                                                                                                                                                                                                                                                                                                                                            property where

                                                                                                                                                                                                                                                                                                                                            where?: AnyWhereOptions | undefined;
                                                                                                                                                                                                                                                                                                                                            • An optional where clause to limit the associated models.

                                                                                                                                                                                                                                                                                                                                            interface HasManyCreateAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyCreateAssociationMixin<TAttributes, TInstance> {}
                                                                                                                                                                                                                                                                                                                                            • The createAssociation mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRoles...
                                                                                                                                                                                                                                                                                                                                              // setRoles...
                                                                                                                                                                                                                                                                                                                                              // addRoles...
                                                                                                                                                                                                                                                                                                                                              // addRole...
                                                                                                                                                                                                                                                                                                                                              createRole: Sequelize.HasManyCreateAssociationMixin<RoleAttributes>;
                                                                                                                                                                                                                                                                                                                                              // removeRole...
                                                                                                                                                                                                                                                                                                                                              // removeRoles...
                                                                                                                                                                                                                                                                                                                                              // hasRole...
                                                                                                                                                                                                                                                                                                                                              // hasRoles...
                                                                                                                                                                                                                                                                                                                                              // countRoles...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            values?: TAttributes,
                                                                                                                                                                                                                                                                                                                                            options?: HasManyCreateAssociationMixinOptions | CreateOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<TInstance>;
                                                                                                                                                                                                                                                                                                                                            • Create a new instance of the associated model and associate it with this.

                                                                                                                                                                                                                                                                                                                                              Parameter values

                                                                                                                                                                                                                                                                                                                                              The values used to create the association.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options to use when creating the association.

                                                                                                                                                                                                                                                                                                                                            interface HasManyCreateAssociationMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManyCreateAssociationMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the createAssociation mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManyCreateAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyGetAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyGetAssociationsMixin<TInstance> {}
                                                                                                                                                                                                                                                                                                                                            • The getAssociations mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              getRoles: Sequelize.HasManyGetAssociationsMixin<RoleInstance>;
                                                                                                                                                                                                                                                                                                                                              // setRoles...
                                                                                                                                                                                                                                                                                                                                              // addRoles...
                                                                                                                                                                                                                                                                                                                                              // addRole...
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              // removeRole...
                                                                                                                                                                                                                                                                                                                                              // removeRoles...
                                                                                                                                                                                                                                                                                                                                              // hasRole...
                                                                                                                                                                                                                                                                                                                                              // hasRoles...
                                                                                                                                                                                                                                                                                                                                              // countRoles...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (options?: HasManyGetAssociationsMixinOptions): Promise<TInstance[]>;
                                                                                                                                                                                                                                                                                                                                            • Get everything currently associated with this, using an optional where clause.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options to use when getting the associations.

                                                                                                                                                                                                                                                                                                                                            interface HasManyGetAssociationsMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManyGetAssociationsMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the getAssociations mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManyGetAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            property include

                                                                                                                                                                                                                                                                                                                                            include?: IncludeOptions | undefined;
                                                                                                                                                                                                                                                                                                                                            • Load further nested related models

                                                                                                                                                                                                                                                                                                                                            property scope

                                                                                                                                                                                                                                                                                                                                            scope?: string | boolean | undefined;
                                                                                                                                                                                                                                                                                                                                            • Apply a scope on the related model, or remove its default scope by passing false.

                                                                                                                                                                                                                                                                                                                                            property where

                                                                                                                                                                                                                                                                                                                                            where?: AnyWhereOptions | undefined;
                                                                                                                                                                                                                                                                                                                                            • An optional where clause to limit the associated models.

                                                                                                                                                                                                                                                                                                                                            interface HasManyHasAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyHasAssociationMixin<TInstance, TInstancePrimaryKey> {}
                                                                                                                                                                                                                                                                                                                                            • The hasAssociation mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRoles...
                                                                                                                                                                                                                                                                                                                                              // setRoles...
                                                                                                                                                                                                                                                                                                                                              // addRoles...
                                                                                                                                                                                                                                                                                                                                              // addRole...
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              // removeRole...
                                                                                                                                                                                                                                                                                                                                              // removeRoles...
                                                                                                                                                                                                                                                                                                                                              hasRole: Sequelize.HasManyHasAssociationMixin<RoleInstance, RoleId>;
                                                                                                                                                                                                                                                                                                                                              // hasRoles...
                                                                                                                                                                                                                                                                                                                                              // countRoles...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            target: TInstance | TInstancePrimaryKey,
                                                                                                                                                                                                                                                                                                                                            options?:
                                                                                                                                                                                                                                                                                                                                            | HasManyHasAssociationMixinOptions
                                                                                                                                                                                                                                                                                                                                            | HasManyGetAssociationsMixinOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<boolean>;
                                                                                                                                                                                                                                                                                                                                            • Check if an instance is associated with this.

                                                                                                                                                                                                                                                                                                                                              Parameter target

                                                                                                                                                                                                                                                                                                                                              The instance or the primary key of the instance to check.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options passed to getAssociations.

                                                                                                                                                                                                                                                                                                                                            interface HasManyHasAssociationMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManyHasAssociationMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the hasAssociation mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManyHasAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyHasAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyHasAssociationsMixin<TInstance, TInstancePrimaryKey> {}
                                                                                                                                                                                                                                                                                                                                            • The removeAssociations mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRoles...
                                                                                                                                                                                                                                                                                                                                              // setRoles...
                                                                                                                                                                                                                                                                                                                                              // addRoles...
                                                                                                                                                                                                                                                                                                                                              // addRole...
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              // removeRole...
                                                                                                                                                                                                                                                                                                                                              // removeRoles
                                                                                                                                                                                                                                                                                                                                              // hasRole...
                                                                                                                                                                                                                                                                                                                                              hasRoles: Sequelize.HasManyHasAssociationsMixin<RoleInstance, RoleId>;
                                                                                                                                                                                                                                                                                                                                              // countRoles...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            targets: Array<TInstance | TInstancePrimaryKey>,
                                                                                                                                                                                                                                                                                                                                            options?:
                                                                                                                                                                                                                                                                                                                                            | HasManyHasAssociationsMixinOptions
                                                                                                                                                                                                                                                                                                                                            | HasManyGetAssociationsMixinOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<boolean>;
                                                                                                                                                                                                                                                                                                                                            • Check if all instances are associated with this.

                                                                                                                                                                                                                                                                                                                                              Parameter targets

                                                                                                                                                                                                                                                                                                                                              An array of instances or primary key of instances to check.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options passed to getAssociations.

                                                                                                                                                                                                                                                                                                                                            interface HasManyHasAssociationsMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManyHasAssociationsMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the hasAssociations mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManyHasAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyRemoveAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyRemoveAssociationMixin<TInstance, TInstancePrimaryKey> {}
                                                                                                                                                                                                                                                                                                                                            • The removeAssociation mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRoles...
                                                                                                                                                                                                                                                                                                                                              // setRoles...
                                                                                                                                                                                                                                                                                                                                              // addRoles...
                                                                                                                                                                                                                                                                                                                                              // addRole...
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              removeRole: Sequelize.HasManyRemoveAssociationMixin<RoleInstance, RoleId>;
                                                                                                                                                                                                                                                                                                                                              // removeRoles...
                                                                                                                                                                                                                                                                                                                                              // hasRole...
                                                                                                                                                                                                                                                                                                                                              // hasRoles...
                                                                                                                                                                                                                                                                                                                                              // countRoles...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            oldAssociated?: TInstance | TInstancePrimaryKey,
                                                                                                                                                                                                                                                                                                                                            options?: HasManyRemoveAssociationMixinOptions | InstanceUpdateOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<void>;
                                                                                                                                                                                                                                                                                                                                            • Un-associate the instance.

                                                                                                                                                                                                                                                                                                                                              Parameter oldAssociated

                                                                                                                                                                                                                                                                                                                                              The instance or the primary key of the instance to un-associate.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options passed to target.update.

                                                                                                                                                                                                                                                                                                                                            interface HasManyRemoveAssociationMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManyRemoveAssociationMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the removeAssociation mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManyRemoveAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyRemoveAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManyRemoveAssociationsMixin<TInstance, TInstancePrimaryKey> {}
                                                                                                                                                                                                                                                                                                                                            • The removeAssociations mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRoles...
                                                                                                                                                                                                                                                                                                                                              // setRoles...
                                                                                                                                                                                                                                                                                                                                              // addRoles...
                                                                                                                                                                                                                                                                                                                                              // addRole...
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              // removeRole...
                                                                                                                                                                                                                                                                                                                                              removeRoles: Sequelize.HasManyRemoveAssociationsMixin<RoleInstance, RoleId>;
                                                                                                                                                                                                                                                                                                                                              // hasRole...
                                                                                                                                                                                                                                                                                                                                              // hasRoles...
                                                                                                                                                                                                                                                                                                                                              // countRoles...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            oldAssociateds?: Array<TInstance | TInstancePrimaryKey>,
                                                                                                                                                                                                                                                                                                                                            options?: HasManyRemoveAssociationsMixinOptions | InstanceUpdateOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<void>;
                                                                                                                                                                                                                                                                                                                                            • Un-associate several instances.

                                                                                                                                                                                                                                                                                                                                              Parameter oldAssociated

                                                                                                                                                                                                                                                                                                                                              An array of instances or primary key of instances to un-associate.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options passed to target.update.

                                                                                                                                                                                                                                                                                                                                            interface HasManyRemoveAssociationsMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManyRemoveAssociationsMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the removeAssociations mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManyRemoveAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManySetAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            interface HasManySetAssociationsMixin<TInstance, TInstancePrimaryKey> {}
                                                                                                                                                                                                                                                                                                                                            • The setAssociations mixin applied to models with hasMany. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasMany(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRoles...
                                                                                                                                                                                                                                                                                                                                              setRoles: Sequelize.HasManySetAssociationsMixin<RoleInstance, RoleId>;
                                                                                                                                                                                                                                                                                                                                              // addRoles...
                                                                                                                                                                                                                                                                                                                                              // addRole...
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              // removeRole...
                                                                                                                                                                                                                                                                                                                                              // removeRoles...
                                                                                                                                                                                                                                                                                                                                              // hasRole...
                                                                                                                                                                                                                                                                                                                                              // hasRoles...
                                                                                                                                                                                                                                                                                                                                              // countRoles...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-many/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            newAssociations?: Array<TInstance | TInstancePrimaryKey>,
                                                                                                                                                                                                                                                                                                                                            options?:
                                                                                                                                                                                                                                                                                                                                            | HasManySetAssociationsMixinOptions
                                                                                                                                                                                                                                                                                                                                            | AnyFindOptions
                                                                                                                                                                                                                                                                                                                                            | InstanceUpdateOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<void>;
                                                                                                                                                                                                                                                                                                                                            • Set the associated models by passing an array of instances or their primary keys. Everything that it not in the passed array will be un-associated.

                                                                                                                                                                                                                                                                                                                                              Parameter newAssociations

                                                                                                                                                                                                                                                                                                                                              An array of instances or primary key of instances to associate with this. Pass null or undefined to remove all associations.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options passed to target.findAll and update.

                                                                                                                                                                                                                                                                                                                                            interface HasManySetAssociationsMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasManySetAssociationsMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the setAssociations mixin of the hasMany association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasManySetAssociationsMixin

                                                                                                                                                                                                                                                                                                                                            property validate

                                                                                                                                                                                                                                                                                                                                            validate?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                            • Run validation for the join model.

                                                                                                                                                                                                                                                                                                                                            interface HasOneCreateAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasOneCreateAssociationMixin<TAttributes> {}
                                                                                                                                                                                                                                                                                                                                            • The createAssociation mixin applied to models with hasOne. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasOne(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRole...
                                                                                                                                                                                                                                                                                                                                              // setRole...
                                                                                                                                                                                                                                                                                                                                              createRole: Sequelize.HasOneCreateAssociationMixin<RoleAttributes>;
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-one/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            values?: TAttributes,
                                                                                                                                                                                                                                                                                                                                            options?:
                                                                                                                                                                                                                                                                                                                                            | HasOneCreateAssociationMixinOptions
                                                                                                                                                                                                                                                                                                                                            | HasOneSetAssociationMixinOptions
                                                                                                                                                                                                                                                                                                                                            | CreateOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<void>;
                                                                                                                                                                                                                                                                                                                                            • Create a new instance of the associated model and associate it with this.

                                                                                                                                                                                                                                                                                                                                              Parameter values

                                                                                                                                                                                                                                                                                                                                              The values used to create the association.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options passed to target.create and setAssociation.

                                                                                                                                                                                                                                                                                                                                            interface HasOneCreateAssociationMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasOneCreateAssociationMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the createAssociation mixin of the hasOne association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasOneCreateAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasOneGetAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasOneGetAssociationMixin<TInstance> {}
                                                                                                                                                                                                                                                                                                                                            • The getAssociation mixin applied to models with hasOne. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasOne(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttrib>, UserAttrib {
                                                                                                                                                                                                                                                                                                                                              getRole: Sequelize.HasOneGetAssociationMixin<RoleInstance>;
                                                                                                                                                                                                                                                                                                                                              // setRole...
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-one/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (options?: HasOneGetAssociationMixinOptions): Promise<TInstance | null>;
                                                                                                                                                                                                                                                                                                                                            • Get the associated instance.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options to use when getting the association.

                                                                                                                                                                                                                                                                                                                                            interface HasOneGetAssociationMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasOneGetAssociationMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the getAssociation mixin of the hasOne association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasOneGetAssociationMixin

                                                                                                                                                                                                                                                                                                                                            property scope

                                                                                                                                                                                                                                                                                                                                            scope?: string | boolean | undefined | null;
                                                                                                                                                                                                                                                                                                                                            • Apply a scope on the related model, or remove its default scope by passing false.

                                                                                                                                                                                                                                                                                                                                            interface HasOneSetAssociationMixin

                                                                                                                                                                                                                                                                                                                                            interface HasOneSetAssociationMixin<TInstance, TInstancePrimaryKey> {}
                                                                                                                                                                                                                                                                                                                                            • The setAssociation mixin applied to models with hasOne. An example of usage is as follows:

                                                                                                                                                                                                                                                                                                                                              User.hasOne(Role);
                                                                                                                                                                                                                                                                                                                                              interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
                                                                                                                                                                                                                                                                                                                                              // getRole...
                                                                                                                                                                                                                                                                                                                                              setRole: Sequelize.HasOneSetAssociationMixin<RoleInstance, RoleId>;
                                                                                                                                                                                                                                                                                                                                              // createRole...
                                                                                                                                                                                                                                                                                                                                              }

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • http://docs.sequelizejs.com/en/latest/api/associations/has-one/

                                                                                                                                                                                                                                                                                                                                              • Instance

                                                                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            newAssociation?: TInstance | TInstancePrimaryKey,
                                                                                                                                                                                                                                                                                                                                            options?:
                                                                                                                                                                                                                                                                                                                                            | HasOneSetAssociationMixinOptions
                                                                                                                                                                                                                                                                                                                                            | HasOneGetAssociationMixinOptions
                                                                                                                                                                                                                                                                                                                                            | InstanceSaveOptions
                                                                                                                                                                                                                                                                                                                                            ): Promise<void>;
                                                                                                                                                                                                                                                                                                                                            • Set the associated instance.

                                                                                                                                                                                                                                                                                                                                              Parameter newAssociation

                                                                                                                                                                                                                                                                                                                                              An instance or the primary key of an instance to associate with this. Pass null or undefined to remove the association.

                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                              The options passed to getAssocation and target.save.

                                                                                                                                                                                                                                                                                                                                            interface HasOneSetAssociationMixinOptions

                                                                                                                                                                                                                                                                                                                                            interface HasOneSetAssociationMixinOptions {}
                                                                                                                                                                                                                                                                                                                                            • The options for the setAssociation mixin of the hasOne association.

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • HasOneSetAssociationMixin

                                                                                                                                                                                                                                                                                                                                            property save

                                                                                                                                                                                                                                                                                                                                            save?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                            • Skip saving this after setting the foreign key if false.

                                                                                                                                                                                                                                                                                                                                            interface Hooks

                                                                                                                                                                                                                                                                                                                                            interface Hooks<TInstance> {}
                                                                                                                                                                                                                                                                                                                                            • Hooks are function that are called before and after (bulk-) creation/updating/deletion and validation. Hooks can be added to you models in three ways:

                                                                                                                                                                                                                                                                                                                                              1. By specifying them as options in sequelize.define 2. By calling hook() with a string and your hook handler function 3. By calling the function with the same name as the hook you want

                                                                                                                                                                                                                                                                                                                                              // Method 1
                                                                                                                                                                                                                                                                                                                                              sequelize.define(name, { attributes }, {
                                                                                                                                                                                                                                                                                                                                              hooks: {
                                                                                                                                                                                                                                                                                                                                              beforeBulkCreate: function () {
                                                                                                                                                                                                                                                                                                                                              // can be a single function
                                                                                                                                                                                                                                                                                                                                              },
                                                                                                                                                                                                                                                                                                                                              beforeValidate: [
                                                                                                                                                                                                                                                                                                                                              function () {},
                                                                                                                                                                                                                                                                                                                                              function() {} // Or an array of several
                                                                                                                                                                                                                                                                                                                                              ]
                                                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                                                              })
                                                                                                                                                                                                                                                                                                                                              // Method 2
                                                                                                                                                                                                                                                                                                                                              Model.hook('afterDestroy', function () {})
                                                                                                                                                                                                                                                                                                                                              // Method 3
                                                                                                                                                                                                                                                                                                                                              Model.afterBulkUpdate(function () {})

                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                              • Sequelize.define

                                                                                                                                                                                                                                                                                                                                            method addHook

                                                                                                                                                                                                                                                                                                                                            addHook: {
                                                                                                                                                                                                                                                                                                                                            (hookType: string, name: string, fn: Function): Hooks<TInstance>;
                                                                                                                                                                                                                                                                                                                                            (hookType: string, fn: Function): Hooks<TInstance>;
                                                                                                                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                                                                                                                            • Add a hook to the model

                                                                                                                                                                                                                                                                                                                                              Parameter hookType

                                                                                                                                                                                                                                                                                                                                              Parameter name

                                                                                                                                                                                                                                                                                                                                              Provide a name for the hook function. It can be used to remove the hook later or to order hooks based on some sort of priority system in the future.

                                                                                                                                                                                                                                                                                                                                              Parameter fn

                                                                                                                                                                                                                                                                                                                                              The hook function

                                                                                                                                                                                                                                                                                                                                              hook

                                                                                                                                                                                                                                                                                                                                            method afterBulkCreate

                                                                                                                                                                                                                                                                                                                                            afterBulkCreate: {
                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                            name: string,
                                                                                                                                                                                                                                                                                                                                            fn: (instances: TInstance[], options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                            ): void;
                                                                                                                                                                                                                                                                                                                                            (fn: (instances: TInstance[], options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                                                                                                                            • A hook that is run after creating instances in bulk

                                                                                                                                                                                                                                                                                                                                              Parameter name

                                                                                                                                                                                                                                                                                                                                              Parameter fn

                                                                                                                                                                                                                                                                                                                                              A callback function that is called with instances, options afterBulkCreate

                                                                                                                                                                                                                                                                                                                                            method afterBulkDelete

                                                                                                                                                                                                                                                                                                                                            afterBulkDelete: {
                                                                                                                                                                                                                                                                                                                                            (name: string, fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                            (fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                            };

                                                                                                                                                                                                                                                                                                                                              method afterBulkDestroy

                                                                                                                                                                                                                                                                                                                                              afterBulkDestroy: {
                                                                                                                                                                                                                                                                                                                                              (name: string, fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                              (fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                              };
                                                                                                                                                                                                                                                                                                                                              • A hook that is run after destroying instances in bulk

                                                                                                                                                                                                                                                                                                                                                Parameter name

                                                                                                                                                                                                                                                                                                                                                Parameter fn

                                                                                                                                                                                                                                                                                                                                                A callback function that is called with options

                                                                                                                                                                                                                                                                                                                                                afterBulkDelete

                                                                                                                                                                                                                                                                                                                                              method afterBulkSync

                                                                                                                                                                                                                                                                                                                                              afterBulkSync: {
                                                                                                                                                                                                                                                                                                                                              (name: string, fn: (options: SyncOptions) => void): void;
                                                                                                                                                                                                                                                                                                                                              (fn: (options: SyncOptions) => void): void;
                                                                                                                                                                                                                                                                                                                                              };
                                                                                                                                                                                                                                                                                                                                              • A hook that is run after sequelize.sync call

                                                                                                                                                                                                                                                                                                                                                Parameter name

                                                                                                                                                                                                                                                                                                                                                Parameter fn

                                                                                                                                                                                                                                                                                                                                                A callback function that is called with options passed to sequelize.sync

                                                                                                                                                                                                                                                                                                                                              method afterBulkUpdate

                                                                                                                                                                                                                                                                                                                                              afterBulkUpdate: {
                                                                                                                                                                                                                                                                                                                                              (name: string, fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                              (fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                              };
                                                                                                                                                                                                                                                                                                                                              • A hook that is run after updating instances in bulk

                                                                                                                                                                                                                                                                                                                                                Parameter name

                                                                                                                                                                                                                                                                                                                                                Parameter fn

                                                                                                                                                                                                                                                                                                                                                A callback function that is called with options

                                                                                                                                                                                                                                                                                                                                              method afterCreate

                                                                                                                                                                                                                                                                                                                                              afterCreate: {
                                                                                                                                                                                                                                                                                                                                              (
                                                                                                                                                                                                                                                                                                                                              name: string,
                                                                                                                                                                                                                                                                                                                                              fn: (attributes: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                              ): void;
                                                                                                                                                                                                                                                                                                                                              (fn: (attributes: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                              };
                                                                                                                                                                                                                                                                                                                                              • A hook that is run after creating a single instance

                                                                                                                                                                                                                                                                                                                                                Parameter name

                                                                                                                                                                                                                                                                                                                                                Parameter fn

                                                                                                                                                                                                                                                                                                                                                A callback function that is called with attributes, options

                                                                                                                                                                                                                                                                                                                                              method afterDefine

                                                                                                                                                                                                                                                                                                                                              afterDefine: {
                                                                                                                                                                                                                                                                                                                                              (name: string, fn: (model: Model<TInstance, any>) => void): void;
                                                                                                                                                                                                                                                                                                                                              (fn: (model: Model<TInstance, any, any>) => void): void;
                                                                                                                                                                                                                                                                                                                                              };
                                                                                                                                                                                                                                                                                                                                              • A hook that is run after a define call

                                                                                                                                                                                                                                                                                                                                                Parameter name

                                                                                                                                                                                                                                                                                                                                                Parameter fn

                                                                                                                                                                                                                                                                                                                                                A callback function that is called with factory

                                                                                                                                                                                                                                                                                                                                              method afterDelete

                                                                                                                                                                                                                                                                                                                                              afterDelete: {
                                                                                                                                                                                                                                                                                                                                              (
                                                                                                                                                                                                                                                                                                                                              name: string,
                                                                                                                                                                                                                                                                                                                                              fn: (instance: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                              ): void;
                                                                                                                                                                                                                                                                                                                                              (fn: (instance: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                              };

                                                                                                                                                                                                                                                                                                                                                method afterDestroy

                                                                                                                                                                                                                                                                                                                                                afterDestroy: {
                                                                                                                                                                                                                                                                                                                                                (
                                                                                                                                                                                                                                                                                                                                                name: string,
                                                                                                                                                                                                                                                                                                                                                fn: (instance: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                                ): void;
                                                                                                                                                                                                                                                                                                                                                (fn: (instance: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                                                                                                                                • A hook that is run after destroying a single instance

                                                                                                                                                                                                                                                                                                                                                  Parameter name

                                                                                                                                                                                                                                                                                                                                                  Parameter fn

                                                                                                                                                                                                                                                                                                                                                  A callback function that is called with instance, options afterDelete

                                                                                                                                                                                                                                                                                                                                                method afterFind

                                                                                                                                                                                                                                                                                                                                                afterFind: {
                                                                                                                                                                                                                                                                                                                                                (
                                                                                                                                                                                                                                                                                                                                                name: string,
                                                                                                                                                                                                                                                                                                                                                fn: (
                                                                                                                                                                                                                                                                                                                                                instancesOrInstance: TInstance[] | TInstance,
                                                                                                                                                                                                                                                                                                                                                options: Object,
                                                                                                                                                                                                                                                                                                                                                fn?: Function
                                                                                                                                                                                                                                                                                                                                                ) => void
                                                                                                                                                                                                                                                                                                                                                ): void;
                                                                                                                                                                                                                                                                                                                                                (
                                                                                                                                                                                                                                                                                                                                                fn: (
                                                                                                                                                                                                                                                                                                                                                instancesOrInstance: TInstance | TInstance[],
                                                                                                                                                                                                                                                                                                                                                options: Object,
                                                                                                                                                                                                                                                                                                                                                fn?: Function
                                                                                                                                                                                                                                                                                                                                                ) => void
                                                                                                                                                                                                                                                                                                                                                ): void;
                                                                                                                                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                                                                                                                                • A hook that is run after a find (select) query

                                                                                                                                                                                                                                                                                                                                                  Parameter name

                                                                                                                                                                                                                                                                                                                                                  Parameter fn

                                                                                                                                                                                                                                                                                                                                                  A callback function that is called with instance(s), options

                                                                                                                                                                                                                                                                                                                                                method afterInit

                                                                                                                                                                                                                                                                                                                                                afterInit: {
                                                                                                                                                                                                                                                                                                                                                (name: string, fn: (sequelize: Sequelize) => void): void;
                                                                                                                                                                                                                                                                                                                                                (fn: (sequelize: Sequelize) => void): void;
                                                                                                                                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                                                                                                                                • A hook that is run after Sequelize() call

                                                                                                                                                                                                                                                                                                                                                  Parameter name

                                                                                                                                                                                                                                                                                                                                                  Parameter fn

                                                                                                                                                                                                                                                                                                                                                  A callback function that is called with sequelize

                                                                                                                                                                                                                                                                                                                                                method afterSync

                                                                                                                                                                                                                                                                                                                                                afterSync: {
                                                                                                                                                                                                                                                                                                                                                (name: string, fn: (options: SyncOptions) => void): void;
                                                                                                                                                                                                                                                                                                                                                (fn: (options: SyncOptions) => void): void;
                                                                                                                                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                                                                                                                                • A hook that is run after Model.sync call

                                                                                                                                                                                                                                                                                                                                                  Parameter name

                                                                                                                                                                                                                                                                                                                                                  Parameter fn

                                                                                                                                                                                                                                                                                                                                                  A callback function that is called with options passed to Model.sync

                                                                                                                                                                                                                                                                                                                                                method afterUpdate

                                                                                                                                                                                                                                                                                                                                                afterUpdate: {
                                                                                                                                                                                                                                                                                                                                                (
                                                                                                                                                                                                                                                                                                                                                name: string,
                                                                                                                                                                                                                                                                                                                                                fn: (instance: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                                ): void;
                                                                                                                                                                                                                                                                                                                                                (fn: (instance: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                                                                                                                                • A hook that is run after updating a single instance

                                                                                                                                                                                                                                                                                                                                                  Parameter name

                                                                                                                                                                                                                                                                                                                                                  Parameter fn

                                                                                                                                                                                                                                                                                                                                                  A callback function that is called with instance, options

                                                                                                                                                                                                                                                                                                                                                method afterValidate

                                                                                                                                                                                                                                                                                                                                                afterValidate: {
                                                                                                                                                                                                                                                                                                                                                (
                                                                                                                                                                                                                                                                                                                                                name: string,
                                                                                                                                                                                                                                                                                                                                                fn: (instance: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                                ): void;
                                                                                                                                                                                                                                                                                                                                                (fn: (instance: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                                                                                                                                • A hook that is run after validation

                                                                                                                                                                                                                                                                                                                                                  Parameter name

                                                                                                                                                                                                                                                                                                                                                  Parameter fn

                                                                                                                                                                                                                                                                                                                                                  A callback function that is called with instance, options

                                                                                                                                                                                                                                                                                                                                                method beforeBulkCreate

                                                                                                                                                                                                                                                                                                                                                beforeBulkCreate: {
                                                                                                                                                                                                                                                                                                                                                (
                                                                                                                                                                                                                                                                                                                                                name: string,
                                                                                                                                                                                                                                                                                                                                                fn: (instances: TInstance[], options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                                ): void;
                                                                                                                                                                                                                                                                                                                                                (fn: (instances: TInstance[], options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                                                                                                                                • A hook that is run before creating instances in bulk

                                                                                                                                                                                                                                                                                                                                                  Parameter name

                                                                                                                                                                                                                                                                                                                                                  Parameter fn

                                                                                                                                                                                                                                                                                                                                                  A callback function that is called with instances, options

                                                                                                                                                                                                                                                                                                                                                method beforeBulkDelete

                                                                                                                                                                                                                                                                                                                                                beforeBulkDelete: {
                                                                                                                                                                                                                                                                                                                                                (name: string, fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                (fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                                                                                                  method beforeBulkDestroy

                                                                                                                                                                                                                                                                                                                                                  beforeBulkDestroy: {
                                                                                                                                                                                                                                                                                                                                                  (name: string, fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                  (fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                  };
                                                                                                                                                                                                                                                                                                                                                  • A hook that is run before destroying instances in bulk

                                                                                                                                                                                                                                                                                                                                                    Parameter name

                                                                                                                                                                                                                                                                                                                                                    Parameter fn

                                                                                                                                                                                                                                                                                                                                                    A callback function that is called with options

                                                                                                                                                                                                                                                                                                                                                    beforeBulkDelete

                                                                                                                                                                                                                                                                                                                                                  method beforeBulkSync

                                                                                                                                                                                                                                                                                                                                                  beforeBulkSync: {
                                                                                                                                                                                                                                                                                                                                                  (name: string, fn: (options: SyncOptions) => void): void;
                                                                                                                                                                                                                                                                                                                                                  (fn: (options: SyncOptions) => void): void;
                                                                                                                                                                                                                                                                                                                                                  };
                                                                                                                                                                                                                                                                                                                                                  • A hook that is run before sequelize.sync call

                                                                                                                                                                                                                                                                                                                                                    Parameter name

                                                                                                                                                                                                                                                                                                                                                    Parameter fn

                                                                                                                                                                                                                                                                                                                                                    A callback function that is called with options passed to sequelize.sync

                                                                                                                                                                                                                                                                                                                                                  method beforeBulkUpdate

                                                                                                                                                                                                                                                                                                                                                  beforeBulkUpdate: {
                                                                                                                                                                                                                                                                                                                                                  (name: string, fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                  (fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                  };
                                                                                                                                                                                                                                                                                                                                                  • A hook that is run after updating instances in bulk

                                                                                                                                                                                                                                                                                                                                                    Parameter name

                                                                                                                                                                                                                                                                                                                                                    Parameter fn

                                                                                                                                                                                                                                                                                                                                                    A callback function that is called with options

                                                                                                                                                                                                                                                                                                                                                  method beforeCreate

                                                                                                                                                                                                                                                                                                                                                  beforeCreate: {
                                                                                                                                                                                                                                                                                                                                                  (
                                                                                                                                                                                                                                                                                                                                                  name: string,
                                                                                                                                                                                                                                                                                                                                                  fn: (attributes: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                                  ): void;
                                                                                                                                                                                                                                                                                                                                                  (fn: (attributes: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                  };
                                                                                                                                                                                                                                                                                                                                                  • A hook that is run before creating a single instance

                                                                                                                                                                                                                                                                                                                                                    Parameter name

                                                                                                                                                                                                                                                                                                                                                    Parameter fn

                                                                                                                                                                                                                                                                                                                                                    A callback function that is called with attributes, options

                                                                                                                                                                                                                                                                                                                                                  method beforeDefine

                                                                                                                                                                                                                                                                                                                                                  beforeDefine: {
                                                                                                                                                                                                                                                                                                                                                  (
                                                                                                                                                                                                                                                                                                                                                  name: string,
                                                                                                                                                                                                                                                                                                                                                  fn: (attributes: DefineAttributes, options: Object) => void
                                                                                                                                                                                                                                                                                                                                                  ): void;
                                                                                                                                                                                                                                                                                                                                                  (fn: (attributes: DefineAttributes, options: Object) => void): void;
                                                                                                                                                                                                                                                                                                                                                  };
                                                                                                                                                                                                                                                                                                                                                  • A hook that is run before a define call

                                                                                                                                                                                                                                                                                                                                                    Parameter name

                                                                                                                                                                                                                                                                                                                                                    Parameter fn

                                                                                                                                                                                                                                                                                                                                                    A callback function that is called with attributes, options

                                                                                                                                                                                                                                                                                                                                                  method beforeDelete

                                                                                                                                                                                                                                                                                                                                                  beforeDelete: {
                                                                                                                                                                                                                                                                                                                                                  (
                                                                                                                                                                                                                                                                                                                                                  name: string,
                                                                                                                                                                                                                                                                                                                                                  fn: (instance: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                                  ): void;
                                                                                                                                                                                                                                                                                                                                                  (fn: (instance: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                                                                                                                                    method beforeDestroy

                                                                                                                                                                                                                                                                                                                                                    beforeDestroy: {
                                                                                                                                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                                                                                                                                    name: string,
                                                                                                                                                                                                                                                                                                                                                    fn: (instance: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                                    ): void;
                                                                                                                                                                                                                                                                                                                                                    (fn: (instance: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                    • A hook that is run before destroying a single instance

                                                                                                                                                                                                                                                                                                                                                      Parameter name

                                                                                                                                                                                                                                                                                                                                                      Parameter fn

                                                                                                                                                                                                                                                                                                                                                      A callback function that is called with instance, options beforeDelete

                                                                                                                                                                                                                                                                                                                                                    method beforeFind

                                                                                                                                                                                                                                                                                                                                                    beforeFind: {
                                                                                                                                                                                                                                                                                                                                                    (name: string, fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                    (fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                    • A hook that is run before a find (select) query

                                                                                                                                                                                                                                                                                                                                                      Parameter name

                                                                                                                                                                                                                                                                                                                                                      Parameter fn

                                                                                                                                                                                                                                                                                                                                                      A callback function that is called with options

                                                                                                                                                                                                                                                                                                                                                    method beforeFindAfterExpandIncludeAll

                                                                                                                                                                                                                                                                                                                                                    beforeFindAfterExpandIncludeAll: {
                                                                                                                                                                                                                                                                                                                                                    (name: string, fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                    (fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                    • A hook that is run before a find (select) query, after any { include: {all: ...} } options are expanded

                                                                                                                                                                                                                                                                                                                                                      Parameter name

                                                                                                                                                                                                                                                                                                                                                      Parameter fn

                                                                                                                                                                                                                                                                                                                                                      A callback function that is called with options

                                                                                                                                                                                                                                                                                                                                                    method beforeFindAfterOptions

                                                                                                                                                                                                                                                                                                                                                    beforeFindAfterOptions: {
                                                                                                                                                                                                                                                                                                                                                    (name: string, fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                    (fn: (options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                    • A hook that is run before a find (select) query, after all option parsing is complete

                                                                                                                                                                                                                                                                                                                                                      Parameter name

                                                                                                                                                                                                                                                                                                                                                      Parameter fn

                                                                                                                                                                                                                                                                                                                                                      A callback function that is called with options

                                                                                                                                                                                                                                                                                                                                                    method beforeInit

                                                                                                                                                                                                                                                                                                                                                    beforeInit: {
                                                                                                                                                                                                                                                                                                                                                    (name: string, fn: (config: Object, options: Object) => void): void;
                                                                                                                                                                                                                                                                                                                                                    (fn: (config: Object, options: Object) => void): void;
                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                    • A hook that is run before Sequelize() call

                                                                                                                                                                                                                                                                                                                                                      Parameter name

                                                                                                                                                                                                                                                                                                                                                      Parameter fn

                                                                                                                                                                                                                                                                                                                                                      A callback function that is called with config, options

                                                                                                                                                                                                                                                                                                                                                    method beforeSync

                                                                                                                                                                                                                                                                                                                                                    beforeSync: {
                                                                                                                                                                                                                                                                                                                                                    (name: string, fn: (options: SyncOptions) => void): void;
                                                                                                                                                                                                                                                                                                                                                    (fn: (options: SyncOptions) => void): void;
                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                    • A hook that is run before Model.sync call

                                                                                                                                                                                                                                                                                                                                                      Parameter name

                                                                                                                                                                                                                                                                                                                                                      Parameter fn

                                                                                                                                                                                                                                                                                                                                                      A callback function that is called with options passed to Model.sync

                                                                                                                                                                                                                                                                                                                                                    method beforeUpdate

                                                                                                                                                                                                                                                                                                                                                    beforeUpdate: {
                                                                                                                                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                                                                                                                                    name: string,
                                                                                                                                                                                                                                                                                                                                                    fn: (instance: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                                    ): void;
                                                                                                                                                                                                                                                                                                                                                    (fn: (instance: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                    • A hook that is run before updating a single instance

                                                                                                                                                                                                                                                                                                                                                      Parameter name

                                                                                                                                                                                                                                                                                                                                                      Parameter fn

                                                                                                                                                                                                                                                                                                                                                      A callback function that is called with instance, options

                                                                                                                                                                                                                                                                                                                                                    method beforeValidate

                                                                                                                                                                                                                                                                                                                                                    beforeValidate: {
                                                                                                                                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                                                                                                                                    name: string,
                                                                                                                                                                                                                                                                                                                                                    fn: (instance: TInstance, options: Object, fn?: Function) => void
                                                                                                                                                                                                                                                                                                                                                    ): void;
                                                                                                                                                                                                                                                                                                                                                    (fn: (instance: TInstance, options: Object, fn?: Function) => void): void;
                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                    • A hook that is run before validation

                                                                                                                                                                                                                                                                                                                                                      Parameter name

                                                                                                                                                                                                                                                                                                                                                      Parameter fn

                                                                                                                                                                                                                                                                                                                                                      A callback function that is called with instance, options

                                                                                                                                                                                                                                                                                                                                                    method hasHook

                                                                                                                                                                                                                                                                                                                                                    hasHook: (hookType: string) => boolean;
                                                                                                                                                                                                                                                                                                                                                    • Check whether the mode has any hooks of this type

                                                                                                                                                                                                                                                                                                                                                      Parameter hookType

                                                                                                                                                                                                                                                                                                                                                      hasHooks

                                                                                                                                                                                                                                                                                                                                                    method hasHooks

                                                                                                                                                                                                                                                                                                                                                    hasHooks: (hookType: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                      method hook

                                                                                                                                                                                                                                                                                                                                                      hook: {
                                                                                                                                                                                                                                                                                                                                                      (hookType: string, name: string, fn: Function): Hooks<TInstance>;
                                                                                                                                                                                                                                                                                                                                                      (hookType: string, fn: Function): Hooks<TInstance>;
                                                                                                                                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                                                                                                                                        method removeHook

                                                                                                                                                                                                                                                                                                                                                        removeHook: (hookType: string, name: string) => Hooks<TInstance>;
                                                                                                                                                                                                                                                                                                                                                        • Remove hook from the model

                                                                                                                                                                                                                                                                                                                                                          Parameter hookType

                                                                                                                                                                                                                                                                                                                                                          Parameter name

                                                                                                                                                                                                                                                                                                                                                        interface HooksDefineOptions

                                                                                                                                                                                                                                                                                                                                                        interface HooksDefineOptions<TInstance> {}
                                                                                                                                                                                                                                                                                                                                                        • Options for Sequelize.define. We mostly duplicate the Hooks here, since there is no way to combine the two interfaces.

                                                                                                                                                                                                                                                                                                                                                          beforeValidate, afterValidate, beforeBulkCreate, beforeBulkDestroy, beforeBulkUpdate, beforeCreate, beforeDestroy, beforeSave, beforeUpdate, afterCreate, afterDestroy, afterSave, afterUpdate, afterBulkCreate, afterBulkDestroy and afterBulkUpdate.

                                                                                                                                                                                                                                                                                                                                                        property afterBulkCreate

                                                                                                                                                                                                                                                                                                                                                        afterBulkCreate?:
                                                                                                                                                                                                                                                                                                                                                        | ((instances: TInstance[], options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                        | undefined;

                                                                                                                                                                                                                                                                                                                                                          property afterBulkDelete

                                                                                                                                                                                                                                                                                                                                                          afterBulkDelete?: ((options: Object, fn?: Function) => any) | undefined;

                                                                                                                                                                                                                                                                                                                                                            property afterBulkDestroy

                                                                                                                                                                                                                                                                                                                                                            afterBulkDestroy?: ((options: Object, fn?: Function) => any) | undefined;

                                                                                                                                                                                                                                                                                                                                                              property afterBulkUpdate

                                                                                                                                                                                                                                                                                                                                                              afterBulkUpdate?: ((options: Object, fn?: Function) => any) | undefined;

                                                                                                                                                                                                                                                                                                                                                                property afterCreate

                                                                                                                                                                                                                                                                                                                                                                afterCreate?:
                                                                                                                                                                                                                                                                                                                                                                | ((attributes: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                | undefined;

                                                                                                                                                                                                                                                                                                                                                                  property afterDelete

                                                                                                                                                                                                                                                                                                                                                                  afterDelete?:
                                                                                                                                                                                                                                                                                                                                                                  | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                  | undefined;

                                                                                                                                                                                                                                                                                                                                                                    property afterDestroy

                                                                                                                                                                                                                                                                                                                                                                    afterDestroy?:
                                                                                                                                                                                                                                                                                                                                                                    | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                    | undefined;

                                                                                                                                                                                                                                                                                                                                                                      property afterFind

                                                                                                                                                                                                                                                                                                                                                                      afterFind?:
                                                                                                                                                                                                                                                                                                                                                                      | ((
                                                                                                                                                                                                                                                                                                                                                                      instancesOrInstance: TInstance[] | TInstance,
                                                                                                                                                                                                                                                                                                                                                                      options: Object,
                                                                                                                                                                                                                                                                                                                                                                      fn?: Function
                                                                                                                                                                                                                                                                                                                                                                      ) => any)
                                                                                                                                                                                                                                                                                                                                                                      | undefined;

                                                                                                                                                                                                                                                                                                                                                                        property afterSave

                                                                                                                                                                                                                                                                                                                                                                        afterSave?:
                                                                                                                                                                                                                                                                                                                                                                        | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                        | undefined;

                                                                                                                                                                                                                                                                                                                                                                          property afterUpdate

                                                                                                                                                                                                                                                                                                                                                                          afterUpdate?:
                                                                                                                                                                                                                                                                                                                                                                          | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                          | undefined;

                                                                                                                                                                                                                                                                                                                                                                            property afterValidate

                                                                                                                                                                                                                                                                                                                                                                            afterValidate?:
                                                                                                                                                                                                                                                                                                                                                                            | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                            | undefined;

                                                                                                                                                                                                                                                                                                                                                                              property beforeBulkCreate

                                                                                                                                                                                                                                                                                                                                                                              beforeBulkCreate?:
                                                                                                                                                                                                                                                                                                                                                                              | ((instances: TInstance[], options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                              | undefined;

                                                                                                                                                                                                                                                                                                                                                                                property beforeBulkDelete

                                                                                                                                                                                                                                                                                                                                                                                beforeBulkDelete?: ((options: Object, fn?: Function) => any) | undefined;

                                                                                                                                                                                                                                                                                                                                                                                  property beforeBulkDestroy

                                                                                                                                                                                                                                                                                                                                                                                  beforeBulkDestroy?: ((options: Object, fn?: Function) => any) | undefined;

                                                                                                                                                                                                                                                                                                                                                                                    property beforeBulkUpdate

                                                                                                                                                                                                                                                                                                                                                                                    beforeBulkUpdate?: ((options: Object, fn?: Function) => any) | undefined;

                                                                                                                                                                                                                                                                                                                                                                                      property beforeCreate

                                                                                                                                                                                                                                                                                                                                                                                      beforeCreate?:
                                                                                                                                                                                                                                                                                                                                                                                      | ((attributes: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                                      | undefined;

                                                                                                                                                                                                                                                                                                                                                                                        property beforeDelete

                                                                                                                                                                                                                                                                                                                                                                                        beforeDelete?:
                                                                                                                                                                                                                                                                                                                                                                                        | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                                        | undefined;

                                                                                                                                                                                                                                                                                                                                                                                          property beforeDestroy

                                                                                                                                                                                                                                                                                                                                                                                          beforeDestroy?:
                                                                                                                                                                                                                                                                                                                                                                                          | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                                          | undefined;

                                                                                                                                                                                                                                                                                                                                                                                            property beforeFind

                                                                                                                                                                                                                                                                                                                                                                                            beforeFind?: ((options: Object, fn?: Function) => any) | undefined;

                                                                                                                                                                                                                                                                                                                                                                                              property beforeFindAfterExpandIncludeAll

                                                                                                                                                                                                                                                                                                                                                                                              beforeFindAfterExpandIncludeAll?:
                                                                                                                                                                                                                                                                                                                                                                                              | ((options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                                              | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                property beforeFindAfterOptions

                                                                                                                                                                                                                                                                                                                                                                                                beforeFindAfterOptions?: ((options: Object, fn?: Function) => any) | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                  property beforeSave

                                                                                                                                                                                                                                                                                                                                                                                                  beforeSave?:
                                                                                                                                                                                                                                                                                                                                                                                                  | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                                                  | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                    property beforeUpdate

                                                                                                                                                                                                                                                                                                                                                                                                    beforeUpdate?:
                                                                                                                                                                                                                                                                                                                                                                                                    | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                                                    | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                      property beforeValidate

                                                                                                                                                                                                                                                                                                                                                                                                      beforeValidate?:
                                                                                                                                                                                                                                                                                                                                                                                                      | ((instance: TInstance, options: Object, fn?: Function) => any)
                                                                                                                                                                                                                                                                                                                                                                                                      | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                        interface HostNotFoundError

                                                                                                                                                                                                                                                                                                                                                                                                        interface HostNotFoundError extends ConnectionError {}

                                                                                                                                                                                                                                                                                                                                                                                                          construct signature

                                                                                                                                                                                                                                                                                                                                                                                                          new (parent: Error): HostNotFoundError;
                                                                                                                                                                                                                                                                                                                                                                                                          • Thrown when a connection to a database has a hostname that was not found

                                                                                                                                                                                                                                                                                                                                                                                                          interface HostNotReachableError

                                                                                                                                                                                                                                                                                                                                                                                                          interface HostNotReachableError extends ConnectionError {}

                                                                                                                                                                                                                                                                                                                                                                                                            construct signature

                                                                                                                                                                                                                                                                                                                                                                                                            new (parent: Error): HostNotReachableError;
                                                                                                                                                                                                                                                                                                                                                                                                            • Thrown when a connection to a database has a hostname that was not reachable

                                                                                                                                                                                                                                                                                                                                                                                                            interface IncludeAssociation

                                                                                                                                                                                                                                                                                                                                                                                                            interface IncludeAssociation {}
                                                                                                                                                                                                                                                                                                                                                                                                            • Association Object for Include Options

                                                                                                                                                                                                                                                                                                                                                                                                            property identifier

                                                                                                                                                                                                                                                                                                                                                                                                            identifier: string;

                                                                                                                                                                                                                                                                                                                                                                                                              property source

                                                                                                                                                                                                                                                                                                                                                                                                              source: Model<any, any>;

                                                                                                                                                                                                                                                                                                                                                                                                                property target

                                                                                                                                                                                                                                                                                                                                                                                                                target: Model<any, any>;

                                                                                                                                                                                                                                                                                                                                                                                                                  interface IncludeOptions

                                                                                                                                                                                                                                                                                                                                                                                                                  interface IncludeOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                  • Complex include options

                                                                                                                                                                                                                                                                                                                                                                                                                  property all

                                                                                                                                                                                                                                                                                                                                                                                                                  all?: boolean | string | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                    property as

                                                                                                                                                                                                                                                                                                                                                                                                                    as?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • The alias of the relation, in case the model you want to eagerly load is aliassed. For hasOne / belongsTo, this should be the singular name, and for hasMany, it should be the plural

                                                                                                                                                                                                                                                                                                                                                                                                                    property association

                                                                                                                                                                                                                                                                                                                                                                                                                    association?: IncludeAssociation | string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • The association you want to eagerly load. (This can be used instead of providing a model/as pair). You can also use the association alias.

                                                                                                                                                                                                                                                                                                                                                                                                                    property attributes

                                                                                                                                                                                                                                                                                                                                                                                                                    attributes?:
                                                                                                                                                                                                                                                                                                                                                                                                                    | FindOptionsAttributesArray
                                                                                                                                                                                                                                                                                                                                                                                                                    | {
                                                                                                                                                                                                                                                                                                                                                                                                                    include?: FindOptionsAttributesArray | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    exclude?: string[] | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                                                                                                                                                                    | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • A list of attributes to select from the child model

                                                                                                                                                                                                                                                                                                                                                                                                                    property include

                                                                                                                                                                                                                                                                                                                                                                                                                    include?:
                                                                                                                                                                                                                                                                                                                                                                                                                    | Array<Model<any, any> | IncludeOptions>
                                                                                                                                                                                                                                                                                                                                                                                                                    | Model<any, any>
                                                                                                                                                                                                                                                                                                                                                                                                                    | IncludeOptions
                                                                                                                                                                                                                                                                                                                                                                                                                    | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Load further nested related models

                                                                                                                                                                                                                                                                                                                                                                                                                    property model

                                                                                                                                                                                                                                                                                                                                                                                                                    model?: Model<any, any> | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • The model you want to eagerly load

                                                                                                                                                                                                                                                                                                                                                                                                                    property nested

                                                                                                                                                                                                                                                                                                                                                                                                                    nested?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • if true, it will also eager load the relations of the child models, recursively.

                                                                                                                                                                                                                                                                                                                                                                                                                    property paranoid

                                                                                                                                                                                                                                                                                                                                                                                                                    paranoid?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will be returned. Only applies if options.paranoid is true for the model.

                                                                                                                                                                                                                                                                                                                                                                                                                    property required

                                                                                                                                                                                                                                                                                                                                                                                                                    required?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • If true, converts to an inner join, which means that the parent model will only be loaded if it has any matching children. True if include.where is set, false otherwise.

                                                                                                                                                                                                                                                                                                                                                                                                                    property separate

                                                                                                                                                                                                                                                                                                                                                                                                                    separate?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • If true, runs a separate query to fetch the associated instances, only supported for hasMany associations

                                                                                                                                                                                                                                                                                                                                                                                                                    property through

                                                                                                                                                                                                                                                                                                                                                                                                                    through?: IncludeThroughOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Through Options

                                                                                                                                                                                                                                                                                                                                                                                                                    property where

                                                                                                                                                                                                                                                                                                                                                                                                                    where?: AnyWhereOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Where clauses to apply to the child models. Note that this converts the eager load to an inner join, unless you explicitly set required: false

                                                                                                                                                                                                                                                                                                                                                                                                                    interface IncludeThroughOptions

                                                                                                                                                                                                                                                                                                                                                                                                                    interface IncludeThroughOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                    • Through options for Include Options

                                                                                                                                                                                                                                                                                                                                                                                                                    property attributes

                                                                                                                                                                                                                                                                                                                                                                                                                    attributes?: string[] | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • A list of attributes to select from the join model for belongsToMany relations

                                                                                                                                                                                                                                                                                                                                                                                                                    property where

                                                                                                                                                                                                                                                                                                                                                                                                                    where?: AnyWhereOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Filter on the join model for belongsToMany relations

                                                                                                                                                                                                                                                                                                                                                                                                                    interface Instance

                                                                                                                                                                                                                                                                                                                                                                                                                    interface Instance<TAttributes> {}
                                                                                                                                                                                                                                                                                                                                                                                                                    • This class represents an single instance, a database row. You might see it referred to as both Instance and instance. You should not instantiate the Instance class directly, instead you access it using the finder and creation methods on the model.

                                                                                                                                                                                                                                                                                                                                                                                                                      Instance instances operate with the concept of a dataValues property, which stores the actual values represented by the instance. By default, the values from dataValues can also be accessed directly from the Instance, that is:

                                                                                                                                                                                                                                                                                                                                                                                                                      instance.field
                                                                                                                                                                                                                                                                                                                                                                                                                      // is the same as
                                                                                                                                                                                                                                                                                                                                                                                                                      instance.get('field')
                                                                                                                                                                                                                                                                                                                                                                                                                      // is the same as
                                                                                                                                                                                                                                                                                                                                                                                                                      instance.getDataValue('field')

                                                                                                                                                                                                                                                                                                                                                                                                                      However, if getters and/or setters are defined for field they will be invoked, instead of returning the value from dataValues. Accessing properties directly or using get is preferred for regular use, getDataValue should only be used for custom getters.

                                                                                                                                                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                                                                                                                                                      • Sequelize.define for more information about getters and setters

                                                                                                                                                                                                                                                                                                                                                                                                                    property isNewRecord

                                                                                                                                                                                                                                                                                                                                                                                                                    isNewRecord: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Returns true if this instance has not yet been persisted to the database

                                                                                                                                                                                                                                                                                                                                                                                                                    property Model

                                                                                                                                                                                                                                                                                                                                                                                                                    Model: Model<this, TAttributes>;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Returns the Model the instance was created from.

                                                                                                                                                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                                                                                                                                                      • Model

                                                                                                                                                                                                                                                                                                                                                                                                                    property sequelize

                                                                                                                                                                                                                                                                                                                                                                                                                    sequelize: Sequelize;
                                                                                                                                                                                                                                                                                                                                                                                                                    • A reference to the sequelize instance

                                                                                                                                                                                                                                                                                                                                                                                                                    method changed

                                                                                                                                                                                                                                                                                                                                                                                                                    changed: { (key: keyof TAttributes): boolean; (): boolean | string[] };
                                                                                                                                                                                                                                                                                                                                                                                                                    • If changed is called with a string it will return a boolean indicating whether the value of that key in dataValues is different from the value in _previousDataValues.

                                                                                                                                                                                                                                                                                                                                                                                                                      If changed is called without an argument, it will return an array of keys that have changed.

                                                                                                                                                                                                                                                                                                                                                                                                                      If changed is called without an argument and no keys have changed, it will return false.

                                                                                                                                                                                                                                                                                                                                                                                                                    method decrement

                                                                                                                                                                                                                                                                                                                                                                                                                    decrement: (
                                                                                                                                                                                                                                                                                                                                                                                                                    fields: Partial<TAttributes> | Array<keyof TAttributes> | keyof TAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                    options?: InstanceIncrementDecrementOptions
                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<this>;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Decrement the value of one or more columns. This is done in the database, which means it does not use the values currently stored on the Instance. The decrement is done using a

                                                                                                                                                                                                                                                                                                                                                                                                                      SET column = column - X

                                                                                                                                                                                                                                                                                                                                                                                                                      query. To get the correct value after an decrement into the Instance you should do a reload.

                                                                                                                                                                                                                                                                                                                                                                                                                      instance.decrement('number') // decrement number by 1
                                                                                                                                                                                                                                                                                                                                                                                                                      instance.decrement(['number', 'count'], { by: 2 }) // decrement number and count by 2
                                                                                                                                                                                                                                                                                                                                                                                                                      instance.decrement({ answer: 42, tries: 1}, { by: 2 }) // decrement answer by 42, and tries by 1.
                                                                                                                                                                                                                                                                                                                                                                                                                      // `by` is ignored, since each column has its own
                                                                                                                                                                                                                                                                                                                                                                                                                      // value

                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter fields

                                                                                                                                                                                                                                                                                                                                                                                                                      If a string is provided, that column is decremented by the value of by given in options. If an array is provided, the same is true for each column. If and object is provided, each column is decremented by the value given

                                                                                                                                                                                                                                                                                                                                                                                                                    method destroy

                                                                                                                                                                                                                                                                                                                                                                                                                    destroy: (options?: InstanceDestroyOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Destroy the row corresponding to this instance. Depending on your setting for paranoid, the row will either be completely deleted, or have its deletedAt timestamp set to the current time.

                                                                                                                                                                                                                                                                                                                                                                                                                    method equals

                                                                                                                                                                                                                                                                                                                                                                                                                    equals: (other: Instance<any>) => boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Check whether all values of this and other Instance are the same

                                                                                                                                                                                                                                                                                                                                                                                                                    method equalsOneOf

                                                                                                                                                                                                                                                                                                                                                                                                                    equalsOneOf: (others: Array<Instance<any>>) => boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Check if this is eqaul to one of others by calling equals

                                                                                                                                                                                                                                                                                                                                                                                                                    method get

                                                                                                                                                                                                                                                                                                                                                                                                                    get: {
                                                                                                                                                                                                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                                                                                                                                                                                                    key: keyof TAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                    options?: { plain?: boolean | undefined; clone?: boolean | undefined }
                                                                                                                                                                                                                                                                                                                                                                                                                    ): any;
                                                                                                                                                                                                                                                                                                                                                                                                                    (options?: { plain?: boolean; clone?: boolean }): TAttributes;
                                                                                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                                                                                    • If no key is given, returns all values of the instance, also invoking virtual getters.

                                                                                                                                                                                                                                                                                                                                                                                                                      If key is given and a field or virtual getter is present for the key it will call that getter - else it will return the value for key.

                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                      options.plain If set to true, included instances will be returned as plain objects

                                                                                                                                                                                                                                                                                                                                                                                                                    method getDataValue

                                                                                                                                                                                                                                                                                                                                                                                                                    getDataValue: (key: keyof TAttributes) => any;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Get the value of the underlying data value

                                                                                                                                                                                                                                                                                                                                                                                                                    method increment

                                                                                                                                                                                                                                                                                                                                                                                                                    increment: (
                                                                                                                                                                                                                                                                                                                                                                                                                    fields: Partial<TAttributes> | Array<keyof TAttributes> | keyof TAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                    options?: InstanceIncrementDecrementOptions
                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<this>;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Increment the value of one or more columns. This is done in the database, which means it does not use the values currently stored on the Instance. The increment is done using a

                                                                                                                                                                                                                                                                                                                                                                                                                      SET column = column + X

                                                                                                                                                                                                                                                                                                                                                                                                                      query. To get the correct value after an increment into the Instance you should do a reload.

                                                                                                                                                                                                                                                                                                                                                                                                                      instance.increment('number') // increment number by 1
                                                                                                                                                                                                                                                                                                                                                                                                                      instance.increment(['number', 'count'], { by: 2 }) // increment number and count by 2
                                                                                                                                                                                                                                                                                                                                                                                                                      instance.increment({ answer: 42, tries: 1}, { by: 2 }) // increment answer by 42, and tries by 1.
                                                                                                                                                                                                                                                                                                                                                                                                                      // `by` is ignored, since each column has its own
                                                                                                                                                                                                                                                                                                                                                                                                                      // value

                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter fields

                                                                                                                                                                                                                                                                                                                                                                                                                      If a string is provided, that column is incremented by the value of by given in options. If an array is provided, the same is true for each column. If and object is provided, each column is incremented by the value given.

                                                                                                                                                                                                                                                                                                                                                                                                                    method previous

                                                                                                                                                                                                                                                                                                                                                                                                                    previous: { (key: keyof TAttributes): any; (): object };
                                                                                                                                                                                                                                                                                                                                                                                                                    • If previous is called with a string, it will return the previous value for the key from _previousDataValues.

                                                                                                                                                                                                                                                                                                                                                                                                                      If previous is called without an argument, it will return an object containing the previous keys and values that have changed.

                                                                                                                                                                                                                                                                                                                                                                                                                    method reload

                                                                                                                                                                                                                                                                                                                                                                                                                    reload: (options?: AnyFindOptions) => Promise<this>;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Refresh the current instance in-place, i.e. update the object with current data from the DB and return the same object. This is different from doing a find(Instance.id), because that would create and return a new instance. With this method, all references to the Instance are updated with the new data and no new objects are created.

                                                                                                                                                                                                                                                                                                                                                                                                                    method restore

                                                                                                                                                                                                                                                                                                                                                                                                                    restore: (options?: InstanceRestoreOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Restore the row corresponding to this instance. Only available for paranoid models.

                                                                                                                                                                                                                                                                                                                                                                                                                    method save

                                                                                                                                                                                                                                                                                                                                                                                                                    save: (options?: InstanceSaveOptions) => Promise<this>;
                                                                                                                                                                                                                                                                                                                                                                                                                    • Validate this instance, and if the validation passes, persist it to the database.

                                                                                                                                                                                                                                                                                                                                                                                                                      On success, the callback will be called with this instance. On validation error, the callback will be called with an instance of Sequelize.ValidationError. This error will have a property for each of the fields for which validation failed, with the error message for that field.

                                                                                                                                                                                                                                                                                                                                                                                                                    method set

                                                                                                                                                                                                                                                                                                                                                                                                                    set: {
                                                                                                                                                                                                                                                                                                                                                                                                                    <K extends keyof TAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                    key: K,
                                                                                                                                                                                                                                                                                                                                                                                                                    value: TAttributes[K],
                                                                                                                                                                                                                                                                                                                                                                                                                    options?: InstanceSetOptions
                                                                                                                                                                                                                                                                                                                                                                                                                    ): this;
                                                                                                                                                                                                                                                                                                                                                                                                                    (keys: Object, options?: InstanceSetOptions): this;
                                                                                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                                                                                    • Set is used to update values on the instance (the sequelize representation of the instance that is, remember that nothing will be persisted before you actually call save). In its most basic form set will update a value stored in the underlying dataValues object. However, if a custom setter function is defined for the key, that function will be called instead. To bypass the setter, you can pass `raw: true` in the options object.

                                                                                                                                                                                                                                                                                                                                                                                                                      If set is called with an object, it will loop over the object, and call set recursively for each key, value pair. If you set raw to true, the underlying dataValues will either be set directly to the object passed, or used to extend dataValues, if dataValues already contain values.

                                                                                                                                                                                                                                                                                                                                                                                                                      When set is called, the previous value of the field is stored and sets a changed flag(see changed).

                                                                                                                                                                                                                                                                                                                                                                                                                      Set can also be used to build instances for associations, if you have values for those. When using set with associations you need to make sure the property key matches the alias of the association while also making sure that the proper include options have been set (from .build() or .find())

                                                                                                                                                                                                                                                                                                                                                                                                                      If called with a dot.seperated key on a JSON/JSONB attribute it will set the value nested and flag the entire object as changed.

                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                      options.raw If set to true, field and virtual setters will be ignored

                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                      options.reset Clear all previously set data values

                                                                                                                                                                                                                                                                                                                                                                                                                    method setAttributes

                                                                                                                                                                                                                                                                                                                                                                                                                    setAttributes: {
                                                                                                                                                                                                                                                                                                                                                                                                                    <K extends keyof TAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                    key: K,
                                                                                                                                                                                                                                                                                                                                                                                                                    value: TAttributes[K],
                                                                                                                                                                                                                                                                                                                                                                                                                    options?: InstanceSetOptions
                                                                                                                                                                                                                                                                                                                                                                                                                    ): this;
                                                                                                                                                                                                                                                                                                                                                                                                                    (keys: Object, options?: InstanceSetOptions): this;
                                                                                                                                                                                                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                                                                                                                                                                                                      method setDataValue

                                                                                                                                                                                                                                                                                                                                                                                                                      setDataValue: <K extends keyof TAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                      key: K,
                                                                                                                                                                                                                                                                                                                                                                                                                      value: TAttributes[K]
                                                                                                                                                                                                                                                                                                                                                                                                                      ) => void;
                                                                                                                                                                                                                                                                                                                                                                                                                      • Update the underlying data value

                                                                                                                                                                                                                                                                                                                                                                                                                      method toJSON

                                                                                                                                                                                                                                                                                                                                                                                                                      toJSON: () => TAttributes;
                                                                                                                                                                                                                                                                                                                                                                                                                      • Convert the instance to a JSON representation. Proxies to calling get with no keys. This means get all values gotten from the DB, and apply all custom getters.

                                                                                                                                                                                                                                                                                                                                                                                                                      method update

                                                                                                                                                                                                                                                                                                                                                                                                                      update: {
                                                                                                                                                                                                                                                                                                                                                                                                                      <K extends keyof TAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                      key: K,
                                                                                                                                                                                                                                                                                                                                                                                                                      value: TAttributes[K],
                                                                                                                                                                                                                                                                                                                                                                                                                      options?: InstanceUpdateOptions
                                                                                                                                                                                                                                                                                                                                                                                                                      ): Promise<this>;
                                                                                                                                                                                                                                                                                                                                                                                                                      (keys: Object, options?: InstanceUpdateOptions): Promise<this>;
                                                                                                                                                                                                                                                                                                                                                                                                                      };
                                                                                                                                                                                                                                                                                                                                                                                                                      • This is the same as calling set and then calling save.

                                                                                                                                                                                                                                                                                                                                                                                                                      method updateAttributes

                                                                                                                                                                                                                                                                                                                                                                                                                      updateAttributes: {
                                                                                                                                                                                                                                                                                                                                                                                                                      <K extends keyof TAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                      key: K,
                                                                                                                                                                                                                                                                                                                                                                                                                      value: TAttributes[K],
                                                                                                                                                                                                                                                                                                                                                                                                                      options?: InstanceUpdateOptions
                                                                                                                                                                                                                                                                                                                                                                                                                      ): Promise<this>;
                                                                                                                                                                                                                                                                                                                                                                                                                      (keys: Object, options?: InstanceUpdateOptions): Promise<this>;
                                                                                                                                                                                                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                                                                                                                                                                                                        method validate

                                                                                                                                                                                                                                                                                                                                                                                                                        validate: (options?: {
                                                                                                                                                                                                                                                                                                                                                                                                                        skip?: string[] | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        }) => Promise<ValidationError>;
                                                                                                                                                                                                                                                                                                                                                                                                                        • Validate the attribute of this instance according to validation rules set in the model definition.

                                                                                                                                                                                                                                                                                                                                                                                                                          Emits null if and only if validation successful; otherwise an Error instance containing { field name : [error msgs] } entries.

                                                                                                                                                                                                                                                                                                                                                                                                                          Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                          options.skip An array of strings. All properties that are in this array will not be validated

                                                                                                                                                                                                                                                                                                                                                                                                                        method where

                                                                                                                                                                                                                                                                                                                                                                                                                        where: () => Object;
                                                                                                                                                                                                                                                                                                                                                                                                                        • Get an object representing the query for this instance, use with options.where

                                                                                                                                                                                                                                                                                                                                                                                                                        interface InstanceDestroyOptions

                                                                                                                                                                                                                                                                                                                                                                                                                        interface InstanceDestroyOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                        • Options used for Instance.destroy method

                                                                                                                                                                                                                                                                                                                                                                                                                        property force

                                                                                                                                                                                                                                                                                                                                                                                                                        force?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        • If set to true, paranoid models will actually be deleted

                                                                                                                                                                                                                                                                                                                                                                                                                        property logging

                                                                                                                                                                                                                                                                                                                                                                                                                        logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        • A function that gets executed while running the query to log the sql.

                                                                                                                                                                                                                                                                                                                                                                                                                        property transaction

                                                                                                                                                                                                                                                                                                                                                                                                                        transaction?: Transaction | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        • Transaction to run the query in

                                                                                                                                                                                                                                                                                                                                                                                                                        interface InstanceIncrementDecrementOptions

                                                                                                                                                                                                                                                                                                                                                                                                                        interface InstanceIncrementDecrementOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                        • Options used for Instance.increment method

                                                                                                                                                                                                                                                                                                                                                                                                                        property by

                                                                                                                                                                                                                                                                                                                                                                                                                        by?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        • The number to increment by

                                                                                                                                                                                                                                                                                                                                                                                                                          Defaults to 1

                                                                                                                                                                                                                                                                                                                                                                                                                        property logging

                                                                                                                                                                                                                                                                                                                                                                                                                        logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        • A function that gets executed while running the query to log the sql.

                                                                                                                                                                                                                                                                                                                                                                                                                        property transaction

                                                                                                                                                                                                                                                                                                                                                                                                                        transaction?: Transaction | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        • Transaction to run query under

                                                                                                                                                                                                                                                                                                                                                                                                                        property where

                                                                                                                                                                                                                                                                                                                                                                                                                        where?: AnyWhereOptions | Array<col | and | or | string> | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        • A hash of attributes to describe your search. See above for examples.

                                                                                                                                                                                                                                                                                                                                                                                                                        interface InstanceRestoreOptions

                                                                                                                                                                                                                                                                                                                                                                                                                        interface InstanceRestoreOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                        • Options used for Instance.restore method

                                                                                                                                                                                                                                                                                                                                                                                                                        property logging

                                                                                                                                                                                                                                                                                                                                                                                                                        logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        • A function that gets executed while running the query to log the sql.

                                                                                                                                                                                                                                                                                                                                                                                                                        property transaction

                                                                                                                                                                                                                                                                                                                                                                                                                        transaction?: Transaction | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                        • Transaction to run query under

                                                                                                                                                                                                                                                                                                                                                                                                                        interface InstanceSaveOptions

                                                                                                                                                                                                                                                                                                                                                                                                                        interface InstanceSaveOptions
                                                                                                                                                                                                                                                                                                                                                                                                                        extends FieldsOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                        LoggingOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                        ReturningOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                        SearchPathOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                        • Options used for Instance.save method

                                                                                                                                                                                                                                                                                                                                                                                                                        property hooks

                                                                                                                                                                                                                                                                                                                                                                                                                        hooks?: boolean | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                          property silent

                                                                                                                                                                                                                                                                                                                                                                                                                          silent?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                          • If true, the updatedAt timestamp will not be updated.

                                                                                                                                                                                                                                                                                                                                                                                                                            Defaults to false

                                                                                                                                                                                                                                                                                                                                                                                                                          interface InstanceSetOptions

                                                                                                                                                                                                                                                                                                                                                                                                                          interface InstanceSetOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                          • Options used for Instance.set method

                                                                                                                                                                                                                                                                                                                                                                                                                          property raw

                                                                                                                                                                                                                                                                                                                                                                                                                          raw?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                          • If set to true, field and virtual setters will be ignored

                                                                                                                                                                                                                                                                                                                                                                                                                          property reset

                                                                                                                                                                                                                                                                                                                                                                                                                          reset?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                          • Clear all previously set data values

                                                                                                                                                                                                                                                                                                                                                                                                                          interface InstanceUpdateOptions

                                                                                                                                                                                                                                                                                                                                                                                                                          interface InstanceUpdateOptions extends InstanceSaveOptions, InstanceSetOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                          • Options used for Instance.update method

                                                                                                                                                                                                                                                                                                                                                                                                                          property where

                                                                                                                                                                                                                                                                                                                                                                                                                          where?: AnyWhereOptions | Array<col | and | or | string> | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                          • A hash of attributes to describe your search. See above for examples.

                                                                                                                                                                                                                                                                                                                                                                                                                          interface InvalidConnectionError

                                                                                                                                                                                                                                                                                                                                                                                                                          interface InvalidConnectionError extends ConnectionError {}

                                                                                                                                                                                                                                                                                                                                                                                                                            construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                            new (parent: Error): InvalidConnectionError;
                                                                                                                                                                                                                                                                                                                                                                                                                            • Thrown when a connection to a database has invalid values for any of the connection parameters

                                                                                                                                                                                                                                                                                                                                                                                                                            interface json

                                                                                                                                                                                                                                                                                                                                                                                                                            interface json {}

                                                                                                                                                                                                                                                                                                                                                                                                                              property conditions

                                                                                                                                                                                                                                                                                                                                                                                                                              conditions?: Object | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                property path

                                                                                                                                                                                                                                                                                                                                                                                                                                path?: string | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                  property value

                                                                                                                                                                                                                                                                                                                                                                                                                                  value?: string | number | boolean | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                    interface jsonStatic

                                                                                                                                                                                                                                                                                                                                                                                                                                    interface jsonStatic {}

                                                                                                                                                                                                                                                                                                                                                                                                                                      construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                      new (conditionsOrPath: string | Object, value?: string | number | boolean): json;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • Creates an object representing nested where conditions for postgres's json data-type.

                                                                                                                                                                                                                                                                                                                                                                                                                                        Parameter conditionsOrPath

                                                                                                                                                                                                                                                                                                                                                                                                                                        A hash containing strings/numbers or other nested hash, a string using dot notation or a string using postgres json syntax.

                                                                                                                                                                                                                                                                                                                                                                                                                                        Parameter value

                                                                                                                                                                                                                                                                                                                                                                                                                                        An optional value to compare against. Produces a string of the form "<json path> = ''".

                                                                                                                                                                                                                                                                                                                                                                                                                                        See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                        • {Model#find}

                                                                                                                                                                                                                                                                                                                                                                                                                                          json

                                                                                                                                                                                                                                                                                                                                                                                                                                      interface literal

                                                                                                                                                                                                                                                                                                                                                                                                                                      interface literal {}

                                                                                                                                                                                                                                                                                                                                                                                                                                        property val

                                                                                                                                                                                                                                                                                                                                                                                                                                        val: any;

                                                                                                                                                                                                                                                                                                                                                                                                                                          interface literalStatic

                                                                                                                                                                                                                                                                                                                                                                                                                                          interface literalStatic {}

                                                                                                                                                                                                                                                                                                                                                                                                                                            construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                            new (val: any): literal;
                                                                                                                                                                                                                                                                                                                                                                                                                                            • Creates a object representing a literal, i.e. something that will not be escaped.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter val

                                                                                                                                                                                                                                                                                                                                                                                                                                            interface LoggingOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                            interface LoggingOptions {}

                                                                                                                                                                                                                                                                                                                                                                                                                                              property benchmark

                                                                                                                                                                                                                                                                                                                                                                                                                                              benchmark?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                              • Print query execution time in milliseconds when logging SQL.

                                                                                                                                                                                                                                                                                                                                                                                                                                              property logging

                                                                                                                                                                                                                                                                                                                                                                                                                                              logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                              • A function that gets executed while running the query to log the sql.

                                                                                                                                                                                                                                                                                                                                                                                                                                              interface Model

                                                                                                                                                                                                                                                                                                                                                                                                                                              interface Model<TInstance, TAttributes, TCreationAttributes = TAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                              extends Hooks<TInstance>,
                                                                                                                                                                                                                                                                                                                                                                                                                                              Associations {}
                                                                                                                                                                                                                                                                                                                                                                                                                                              • A Model represents a table in the database. Sometimes you might also see it referred to as model, or simply as factory. This class should _not_ be instantiated directly, it is created using sequelize.define, and already created models can be loaded using sequelize.import

                                                                                                                                                                                                                                                                                                                                                                                                                                              property name

                                                                                                                                                                                                                                                                                                                                                                                                                                              name: string;
                                                                                                                                                                                                                                                                                                                                                                                                                                              • The singular name of the model

                                                                                                                                                                                                                                                                                                                                                                                                                                              method addScope

                                                                                                                                                                                                                                                                                                                                                                                                                                              addScope: {
                                                                                                                                                                                                                                                                                                                                                                                                                                              (
                                                                                                                                                                                                                                                                                                                                                                                                                                              name: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                              scope: AnyFindOptions | Function,
                                                                                                                                                                                                                                                                                                                                                                                                                                              options?: AddScopeOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                              ): void;
                                                                                                                                                                                                                                                                                                                                                                                                                                              (
                                                                                                                                                                                                                                                                                                                                                                                                                                              name: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                              scope: Function | AnyFindOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                              options?: AddScopeOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                              ): void;
                                                                                                                                                                                                                                                                                                                                                                                                                                              };
                                                                                                                                                                                                                                                                                                                                                                                                                                              • Add a new scope to the model. This is especially useful for adding scopes with includes, when the model you want to include is not available at the time this model is defined.

                                                                                                                                                                                                                                                                                                                                                                                                                                                By default this will throw an error if a scope with that name already exists. Pass override: true in the options object to silence this error.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter name

                                                                                                                                                                                                                                                                                                                                                                                                                                                The name of the scope. Use defaultScope to override the default scope

                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter scope

                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                {Boolean} [options.override=false]

                                                                                                                                                                                                                                                                                                                                                                                                                                              method aggregate

                                                                                                                                                                                                                                                                                                                                                                                                                                              aggregate: (
                                                                                                                                                                                                                                                                                                                                                                                                                                              field: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                              aggregateFunction: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                              options?: AggregateOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                              ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                              • Run an aggregation method on the specified field

                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter field

                                                                                                                                                                                                                                                                                                                                                                                                                                                The field to aggregate over. Can be a field name or *

                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter aggregateFunction

                                                                                                                                                                                                                                                                                                                                                                                                                                                The function to use for aggregation, e.g. sum, max etc.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                Query options. See sequelize.query for full options Returns the aggregate result cast to options.dataType, unless options.plain is false, in which case the complete data result is returned.

                                                                                                                                                                                                                                                                                                                                                                                                                                              method all

                                                                                                                                                                                                                                                                                                                                                                                                                                              all: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                              options?: FindOptions<TAttributes & TCustomAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                              ) => Promise<TInstance[]>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                method associate

                                                                                                                                                                                                                                                                                                                                                                                                                                                associate: (models: Models) => void;
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Set associations with other models

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Not part of the sequelize API, used as convention to associate models after creation. e.g.:

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Object.keys(models).forEach(modelName => {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  if (models[modelName].associate) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  models[modelName].associate(models);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                                                                                                                                                  });

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter models

                                                                                                                                                                                                                                                                                                                                                                                                                                                method build

                                                                                                                                                                                                                                                                                                                                                                                                                                                build: (record?: TAttributes, options?: BuildOptions) => TInstance;
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Builds a new model instance. Values is an object of key value pairs, must be defined but can be empty.

                                                                                                                                                                                                                                                                                                                                                                                                                                                method bulkBuild

                                                                                                                                                                                                                                                                                                                                                                                                                                                bulkBuild: (records: TAttributes[], options?: BuildOptions) => TInstance[];
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Undocumented bulkBuild

                                                                                                                                                                                                                                                                                                                                                                                                                                                method bulkCreate

                                                                                                                                                                                                                                                                                                                                                                                                                                                bulkCreate: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                records: TCreationAttributes[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                options?: BulkCreateOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                ) => Promise<TInstance[]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Create and insert multiple instances in bulk.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The success handler is passed an array of instances, but please notice that these may not completely represent the state of the rows in the DB. This is because MySQL and SQLite do not make it easy to obtain back automatically generated IDs and other default values in a way that can be mapped to multiple records. To obtain Instances for the newly created values, you will need to query for them again.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter records

                                                                                                                                                                                                                                                                                                                                                                                                                                                  List of objects (key/value pairs) to create instances from

                                                                                                                                                                                                                                                                                                                                                                                                                                                method count

                                                                                                                                                                                                                                                                                                                                                                                                                                                count: (options?: CountOptions) => Promise<number>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Count the number of records matching the provided where clause.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  If you provide an include option, the number of matching associations will be counted instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                method create

                                                                                                                                                                                                                                                                                                                                                                                                                                                create: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                values?: TCreationAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                                                options?: CreateOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                ) => Promise<TInstance>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Builds a new model instance and calls save on it.

                                                                                                                                                                                                                                                                                                                                                                                                                                                method describe

                                                                                                                                                                                                                                                                                                                                                                                                                                                describe: () => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Run a describe query on the table. The result will be return to the listener as a hash of attributes and their types.

                                                                                                                                                                                                                                                                                                                                                                                                                                                method destroy

                                                                                                                                                                                                                                                                                                                                                                                                                                                destroy: (options?: DestroyOptions) => Promise<number>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Delete multiple instances, or set their deletedAt timestamp to the current time if paranoid is enabled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Promise The number of destroyed rows

                                                                                                                                                                                                                                                                                                                                                                                                                                                method drop

                                                                                                                                                                                                                                                                                                                                                                                                                                                drop: (options?: DropOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Drop the table represented by this Model

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                method find

                                                                                                                                                                                                                                                                                                                                                                                                                                                find: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                options?: FindOptions<TAttributes & TCustomAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                ) => Promise<TInstance>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                  method findAll

                                                                                                                                                                                                                                                                                                                                                                                                                                                  findAll: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                  options?: FindOptions<TAttributes & TCustomAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                  ) => Promise<TInstance[]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Search for multiple instances.

                                                                                                                                                                                                                                                                                                                                                                                                                                                    __Simple search using AND and =__

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Model.findAll({
                                                                                                                                                                                                                                                                                                                                                                                                                                                    where: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    attr1: 42,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    attr2: 'cake'
                                                                                                                                                                                                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                    WHERE attr1 = 42 AND attr2 = 'cake'

                                                                                                                                                                                                                                                                                                                                                                                                                                                    __Using greater than, less than etc.__

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Model.findAll({
                                                                                                                                                                                                                                                                                                                                                                                                                                                    where: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    attr1: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    gt: 50
                                                                                                                                                                                                                                                                                                                                                                                                                                                    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                    attr2: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    lte: 45
                                                                                                                                                                                                                                                                                                                                                                                                                                                    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                    attr3: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    in: [1,2,3]
                                                                                                                                                                                                                                                                                                                                                                                                                                                    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                    attr4: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    ne: 5
                                                                                                                                                                                                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                    WHERE attr1 > 50 AND attr2 <= 45 AND attr3 IN (1,2,3) AND attr4 != 5

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Possible options are: `$ne, $in, $not, $notIn, $gte, $gt, $lte, $lt, $like, $ilike/$iLike, $notLike, $notILike, '..'/$between, '!..'/$notBetween, '&&'/$overlap, '@>'/$contains, '<@'/$contained`

                                                                                                                                                                                                                                                                                                                                                                                                                                                    __Queries using OR__

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Model.findAll({
                                                                                                                                                                                                                                                                                                                                                                                                                                                    where: Sequelize.and(
                                                                                                                                                                                                                                                                                                                                                                                                                                                    { name: 'a project' },
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Sequelize.or(
                                                                                                                                                                                                                                                                                                                                                                                                                                                    { id: [1,2,3] },
                                                                                                                                                                                                                                                                                                                                                                                                                                                    { id: { gt: 10 } }
                                                                                                                                                                                                                                                                                                                                                                                                                                                    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                    WHERE name = 'a project' AND (id` IN (1,2,3) OR id > 10)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    The success listener is called with an array of instances if the query succeeds.

                                                                                                                                                                                                                                                                                                                                                                                                                                                    See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                    • {Sequelize#query}

                                                                                                                                                                                                                                                                                                                                                                                                                                                  method findAndCount

                                                                                                                                                                                                                                                                                                                                                                                                                                                  findAndCount: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                  options?: FindOptions<TAttributes & TCustomAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                  ) => Promise<{ rows: TInstance[]; count: number }>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Find all the rows matching your query, within a specified offset / limit, and get the total number of rows matching your query. This is very usefull for paging

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Model.findAndCountAll({
                                                                                                                                                                                                                                                                                                                                                                                                                                                    where: ...,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    limit: 12,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    offset: 12
                                                                                                                                                                                                                                                                                                                                                                                                                                                    }).then(function (result) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    ...
                                                                                                                                                                                                                                                                                                                                                                                                                                                    })

                                                                                                                                                                                                                                                                                                                                                                                                                                                    In the above example, result.rows will contain rows 13 through 24, while result.count will return the total number of rows that matched your query.

                                                                                                                                                                                                                                                                                                                                                                                                                                                    When you add includes, only those which are required (either because they have a where clause, or because required is explicitly set to true on the include) will be added to the count part.

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Suppose you want to find all users who have a profile attached:

                                                                                                                                                                                                                                                                                                                                                                                                                                                    User.findAndCountAll({
                                                                                                                                                                                                                                                                                                                                                                                                                                                    include: [
                                                                                                                                                                                                                                                                                                                                                                                                                                                    { model: Profile, required: true}
                                                                                                                                                                                                                                                                                                                                                                                                                                                    ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                    limit 3
                                                                                                                                                                                                                                                                                                                                                                                                                                                    });

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Because the include for Profile has required set it will result in an inner join, and only the users who have a profile will be counted. If we remove required from the include, both users with and without profiles will be counted

                                                                                                                                                                                                                                                                                                                                                                                                                                                  method findAndCountAll

                                                                                                                                                                                                                                                                                                                                                                                                                                                  findAndCountAll: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                  options?: FindOptions<TAttributes & TCustomAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                  ) => Promise<{ rows: TInstance[]; count: number }>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                    method findById

                                                                                                                                                                                                                                                                                                                                                                                                                                                    findById: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                    identifier?: number | string | Buffer,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: Omit<FindOptions<TAttributes & TCustomAttributes>, 'where'>
                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<TInstance>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Search for a single instance by its primary key. This applies LIMIT 1, so the listener will always be called with a single instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                    method findByPk

                                                                                                                                                                                                                                                                                                                                                                                                                                                    findByPk: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                    identifier?: number | string | Buffer,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: Omit<FindOptions<TAttributes & TCustomAttributes>, 'where'>
                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<TInstance>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                      method findByPrimary

                                                                                                                                                                                                                                                                                                                                                                                                                                                      findByPrimary: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                      identifier?: number | string | Buffer,
                                                                                                                                                                                                                                                                                                                                                                                                                                                      options?: Omit<FindOptions<TAttributes & TCustomAttributes>, 'where'>
                                                                                                                                                                                                                                                                                                                                                                                                                                                      ) => Promise<TInstance>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                        method findCreateFind

                                                                                                                                                                                                                                                                                                                                                                                                                                                        findCreateFind: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                        options: FindCreateFindOptions<TAttributes & TCustomAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                        ) => Promise<[TInstance, boolean]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • A more performant findOrCreate that will not work under a transaction (at least not in postgres) Will execute a find call, if empty then attempt to create, if unique constraint then attempt to find again

                                                                                                                                                                                                                                                                                                                                                                                                                                                        method findOne

                                                                                                                                                                                                                                                                                                                                                                                                                                                        findOne: <TCustomAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                        options?: FindOptions<TAttributes & TCustomAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                        ) => Promise<TInstance>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Search for a single instance. This applies LIMIT 1, so the listener will always be called with a single instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                        method findOrBuild

                                                                                                                                                                                                                                                                                                                                                                                                                                                        findOrBuild: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                        options: FindOrInitializeOptions<TAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                        ) => Promise<[TInstance, boolean]>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                          method findOrCreate

                                                                                                                                                                                                                                                                                                                                                                                                                                                          findOrCreate: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                          options: FindOrInitializeOptions<TAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                          ) => Promise<[TInstance, boolean]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Find a row that matches the query, or build and save the row if none is found The successful result of the promise will be (instance, created) - Make sure to use .spread()

                                                                                                                                                                                                                                                                                                                                                                                                                                                            If no transaction is passed in the options object, a new transaction will be created internally, to prevent the race condition where a matching row is created by another connection after the find but before the insert call. However, it is not always possible to handle this case in SQLite, specifically if one transaction inserts and another tries to select before the first one has comitted. In this case, an instance of sequelize.TimeoutError will be thrown instead. If a transaction is created, a savepoint will be created instead, and any unique constraint violation will be handled internally.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          method findOrInitialize

                                                                                                                                                                                                                                                                                                                                                                                                                                                          findOrInitialize: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                          options: FindOrInitializeOptions<TAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                          ) => Promise<[TInstance, boolean]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Find a row that matches the query, or build (but don't save) the row if none is found. The successfull result of the promise will be (instance, initialized) - Make sure to use .spread()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          method getTableName

                                                                                                                                                                                                                                                                                                                                                                                                                                                          getTableName: (options?: GetTableNameOptions) => string | Object;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Get the tablename of the model, taking schema into account. The method will return The name as a string if the model has no schema, or an object with tableName, schema and delimiter properties.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                            The hash of options from any query. You can use one model to access tables with matching schemas by overriding getTableName and using custom key/values to alter the name of the table. (eg. subscribers_1, subscribers_2)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                            options.logging=false A function that gets executed while running the query to log the sql.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          method insertOrUpdate

                                                                                                                                                                                                                                                                                                                                                                                                                                                          insertOrUpdate: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          (
                                                                                                                                                                                                                                                                                                                                                                                                                                                          values: TAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          options?: UpsertOptions & { returning: false | undefined }
                                                                                                                                                                                                                                                                                                                                                                                                                                                          ): Promise<boolean>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          (
                                                                                                                                                                                                                                                                                                                                                                                                                                                          values: TAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          options?: UpsertOptions & { returning: true }
                                                                                                                                                                                                                                                                                                                                                                                                                                                          ): Promise<[TInstance, boolean]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          };

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method Instance

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instance: () => TInstance;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The Instance class

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method max

                                                                                                                                                                                                                                                                                                                                                                                                                                                            max: (field: string, options?: AggregateOptions) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Find the maximum value of field

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method min

                                                                                                                                                                                                                                                                                                                                                                                                                                                            min: (field: string, options?: AggregateOptions) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Find the minimum value of field

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method removeAttribute

                                                                                                                                                                                                                                                                                                                                                                                                                                                            removeAttribute: (attribute: string) => void;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Remove attribute from model definition

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter attribute

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method restore

                                                                                                                                                                                                                                                                                                                                                                                                                                                            restore: (options?: RestoreOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Restore multiple instances if paranoid is enabled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                            schema: (schema: string, options?: SchemaOptions) => this;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Apply a schema to this model. For postgres, this will actually place the schema in front of the table name - "schema"."tableName", while the schema will be prepended to the table name for mysql and sqlite - 'schema.tablename'.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The name of the schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method scope

                                                                                                                                                                                                                                                                                                                                                                                                                                                            scope: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                            options?:
                                                                                                                                                                                                                                                                                                                                                                                                                                                            | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                            | ScopeOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                            | AnyWhereOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Array<string | ScopeOptions | AnyWhereOptions>
                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => this;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Apply a scope created in define to the model. First let's look at how to create scopes:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              var Model = sequelize.define('model', attributes, {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              defaultScope: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              where: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              username: 'dan'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              },
                                                                                                                                                                                                                                                                                                                                                                                                                                                              limit: 12
                                                                                                                                                                                                                                                                                                                                                                                                                                                              },
                                                                                                                                                                                                                                                                                                                                                                                                                                                              scopes: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              isALie: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              where: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              stuff: 'cake'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              },
                                                                                                                                                                                                                                                                                                                                                                                                                                                              complexFunction: function(email, accessLevel) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              return {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              where: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              email: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $like: email
                                                                                                                                                                                                                                                                                                                                                                                                                                                              },
                                                                                                                                                                                                                                                                                                                                                                                                                                                              accesss_level {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $gte: accessLevel
                                                                                                                                                                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              })

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Now, since you defined a default scope, every time you do Model.find, the default scope is appended to your query. Here's a couple of examples:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Model.findAll() // WHERE username = 'dan'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              Model.findAll({ where: { age: { gt: 12 } } }) // WHERE age > 12 AND username = 'dan'

                                                                                                                                                                                                                                                                                                                                                                                                                                                              To invoke scope functions you can do:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Model.scope({ method: ['complexFunction' 'dan@sequelize.com', 42]}).findAll()
                                                                                                                                                                                                                                                                                                                                                                                                                                                              // WHERE email like 'dan@sequelize.com%' AND access_level >= 42

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Model A reference to the model, with the scope(s) applied. Calling scope again on the returned model will clear the previous scope.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method sum

                                                                                                                                                                                                                                                                                                                                                                                                                                                            sum: (field: string, options?: AggregateOptions) => Promise<number>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Find the sum of field

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method sync

                                                                                                                                                                                                                                                                                                                                                                                                                                                            sync: (options?: SyncOptions) => Promise<this>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Sync this Model to the DB, that is create the table. Upon success, the callback will be called with the model instance (this)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method truncate

                                                                                                                                                                                                                                                                                                                                                                                                                                                            truncate: (options?: TruncateOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Truncate all instances of the model. This is a convenient method for Model.destroy({ truncate: true }).

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method unscoped

                                                                                                                                                                                                                                                                                                                                                                                                                                                            unscoped: () => this;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Unscope the model

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method update

                                                                                                                                                                                                                                                                                                                                                                                                                                                            update: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                            values: Partial<TAttributes>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            options?: UpdateOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => Promise<[number, TInstance[]]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Update multiple instances that match the where options. The promise returns an array with one or two elements. The first element is always the number of affected rows, while the second element is the actual affected rows (only supported in postgres with options.returning true.)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            method upsert

                                                                                                                                                                                                                                                                                                                                                                                                                                                            upsert: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                                                                                                                                            values: TAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            options?: UpsertOptions & { returning?: false | undefined }
                                                                                                                                                                                                                                                                                                                                                                                                                                                            ): Promise<boolean>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            (
                                                                                                                                                                                                                                                                                                                                                                                                                                                            values: TAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            options?: UpsertOptions & { returning: true }
                                                                                                                                                                                                                                                                                                                                                                                                                                                            ): Promise<[TInstance, boolean]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Insert or update a single row. An update will be executed if a row which matches the supplied values on either the primary key or a unique key is found. Note that the unique index must be defined in your sequelize model and not just in the table. Otherwise you may experience a unique constraint violation, because sequelize fails to identify the row that should be updated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              **Implementation details:**

                                                                                                                                                                                                                                                                                                                                                                                                                                                              * MySQL - Implemented as a single query INSERT values ON DUPLICATE KEY UPDATE values * PostgreSQL - Implemented as a temporary function with exception handling: INSERT EXCEPTION WHEN unique_constraint UPDATE * SQLite - Implemented as two queries INSERT; UPDATE. This means that the update is executed regardless of whether the row already existed or not

                                                                                                                                                                                                                                                                                                                                                                                                                                                              **Note** that SQLite returns undefined for created, no matter if the row was created or updated. This is because SQLite always runs INSERT OR IGNORE + UPDATE, in a single query, so there is no way to know whether the row was inserted or not.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface Models

                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface Models {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Models contains Model instances associated to their name

                                                                                                                                                                                                                                                                                                                                                                                                                                                            index signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                            [index: string]: Model<any, any>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface ModelsHashInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface ModelsHashInterface {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                index signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                [name: string]: Model<any, any>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface Operators

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface Operators {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Operator symbols to be used when querying data

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property adjacent

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  adjacent: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property all

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    all: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property and

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      and: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property any

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        any: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property between

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          between: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property col

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            col: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property contained

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              contained: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property contains

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                contains: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property eq

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  eq: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property gt

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    gt: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property gte

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      gte: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property iLike

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        iLike: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property in

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          in: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property iRegexp

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            iRegexp: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property is

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              is: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property join

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                join: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property like

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  like: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property lt

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    lt: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property lte

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      lte: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property ne

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ne: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property noExtendLeft

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          noExtendLeft: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property noExtendRight

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            noExtendRight: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property not

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              not: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property notBetween

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                notBetween: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property notILike

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  notILike: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property notIn

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    notIn: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property notIRegexp

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      notIRegexp: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property notLike

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        notLike: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property notRegexp

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          notRegexp: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property or

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            or: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property overlap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              overlap: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property placeholder

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                placeholder: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property raw

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  raw: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property regexp

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    regexp: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property strictLeft

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      strictLeft: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property strictRight

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        strictRight: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property values

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          values: symbol;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface Options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface Options {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Options for the constructor of Sequelize main class

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property benchmark

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            benchmark?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Print query execution time in milliseconds when logging SQL.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to false

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property database

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            database?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The name of the database

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property databaseVersion

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            databaseVersion?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The version of the database. Most times, this is automatically detected and is not needed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to 0

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property define

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            define?: DefineOptions<any> | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Default options for model definitions. See sequelize.define for options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property dialect

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            dialect?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The dialect of the database you are connecting to. One of mysql, postgres, sqlite, mariadb and mssql.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to 'mysql'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property dialectModulePath

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            dialectModulePath?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • If specified, load the dialect library from this path. For example, if you want to use pg.js instead of pg when connecting to a pg database, you should specify 'pg.js' here

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property dialectOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            dialectOptions?: Object | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • An object of additional options, which are passed directly to the connection library

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property host

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            host?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The host of the relational database.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to 'localhost'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property isolationLevel

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            isolationLevel?: TransactionIsolationLevel | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Set the default transaction isolation level. See Sequelize.Transaction.ISOLATION_LEVELS for possible options.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to 'REPEATABLE_READ'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • A function that gets executed everytime Sequelize would log something.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to console.log

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property native

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            native?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • A flag that defines if native library shall be used or not. Currently only has an effect for postgres

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to false

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property omitNull

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            omitNull?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • A flag that defines if null values should be passed to SQL queries or not.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to false

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property operatorsAliases

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            operatorsAliases?: boolean | OperatorsAliases | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • String based operator alias, default value is true which will enable all operators alias. Pass object to limit set of aliased operators or false to disable completely.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property password

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            password?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The password which is used to authenticate against the database.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property pool

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            pool?: PoolOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Connection pool options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property port

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            port?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The port of the relational database.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property protocol

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            protocol?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The protocol of the relational database.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to 'tcp'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property query

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            query?: QueryOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Default options for sequelize.query

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property quoteIdentifiers

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            quoteIdentifiers?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Set to false to make table names and attributes case-insensitive on Postgres and skip double quoting of them.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to true

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property replication

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            replication?: ReplicationOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Use read / write replication. To enable replication, pass an object, with two properties, read and write. Write should be an object (a single server for handling writes), and read an array of object (several servers to handle reads). Each read/write server can have the following properties: host, port, username, password, database

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to false

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property retry

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            retry?: RetryOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Set of flags that control when a query is automatically retried.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property set

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            set?: SetOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Default options for sequelize.set

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property ssl

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ssl?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Set to true to enable connecting over SSL.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to undefined

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property storage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            storage?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Only used by sqlite.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to ':memory:'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property sync

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            sync?: SyncOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Default options for sequelize.sync

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property timezone

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            timezone?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The timezone used when converting a date from the database into a JavaScript date. The timezone is also used to SET TIMEZONE when connecting to the server, to ensure that the result of NOW, CURRENT_TIMESTAMP and other time related functions have in the right timezone. For best cross platform performance use the format +/-HH:MM. Will also accept string versions of timezones used by moment.js (e.g. 'America/Los_Angeles'); this is useful to capture daylight savings time changes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to '+00:00'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property transactionType

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            transactionType?: TransactionType | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Set the default transaction type. See Sequelize.Transaction.TYPES for possible options.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to 'DEFERRED'

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property typeValidation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            typeValidation?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Run built in type validators on insert and update, e.g. validate that arguments passed to integer fields are integer-like.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to false

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property username

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            username?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The username which is used to authenticate against the database.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface or

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface or {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property args

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              args: any[];

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                interface orStatic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                interface orStatic {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  new (...args: Array<string | Object>): or;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • An OR query

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Parameter args

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Each argument will be joined by OR

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • {Model#find}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface PoolOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface PoolOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Connection Pool options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property acquire

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  acquire?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • The maximum time, in milliseconds, that pool will try to get connection before throwing error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property evict

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  evict?: number | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property idle

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    idle?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • The maximum time, in milliseconds, that a connection can be idle before being released.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property max

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    max?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Maximum connections of the pool

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property min

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    min?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Minimum connections of the pool

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property validate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    validate?: ((client?: any) => boolean) | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • A function that validates a connection. Called with client. The default function checks that client is an object, and that its state is not disconnected.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface QueryInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface QueryInterface {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • The interface that Sequelize uses to talk to all databases.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      This interface is available through sequelize.QueryInterface. It should not be commonly used, but it's referenced anyway, so it can be used.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property QueryGenerator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    QueryGenerator: any;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Returns the dialect-specific sql generator.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      We don't have a definition for the QueryGenerator, because I doubt it is commonly in use separately.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property sequelize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    sequelize: Sequelize;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Returns the current sequelize instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method "delete"

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    delete: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    instance: Instance<any>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    identifier: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Deletes a row

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method addColumn

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    addColumn: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | { tableName?: string | undefined; schema?: string | undefined },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    key: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attribute: DefineAttributeColumnOptions | DataTypeAbstract,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Adds a new column to a table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method addConstraint

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    addConstraint: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attributes: string[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: AddConstraintOptions | QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Adds constraints to a table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method addIndex

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    addIndex: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string | Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options: DefineIndexOptions & { fields: string[] },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    rawTablename?: string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ): Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string | Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attributes: string[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: DefineIndexOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    rawTablename?: string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ): Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Adds a new index to a table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method bulkDelete

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    bulkDelete: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    identifier: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    model?: Model<any, any>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Deletes multiple rows at once

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method bulkInsert

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    bulkInsert: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string | { tableName: string; schema: string },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    records: Object[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attributes?: string[] | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Inserts multiple records at once

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method bulkUpdate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    bulkUpdate: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    values: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    identifier: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attributes?: string[] | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Updates multiple rows at once

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method changeColumn

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    changeColumn: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | { schema?: string | undefined; tableName?: string | undefined },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attributeName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    dataTypeOrOptions?: string | DataTypeAbstract | DefineAttributeColumnOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Changes a column

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method commitTransaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    commitTransaction: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    transaction: Transaction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Commit an already started transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method createFunction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    createFunction: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    functionName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    params: any[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    returnType: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    language: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    body: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Postgres only. Create a function

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method createSchema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    createSchema: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    schema?: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Queries the schema (table list).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The schema to query. Applies only to Postgres.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method createTable

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    createTable: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | { schema?: string | undefined; tableName?: string | undefined },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attributes: DefineAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Creates a table with specified attributes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter tableName

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Name of table to create

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter attributes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Hash of attributes, key is attribute name, value is data type

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Query options.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method createTrigger

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    createTrigger: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    triggerName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    timingType: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    fireOnArray: any[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    functionName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    functionParams: any[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    optionsArray: string[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Postgres only. Creates a trigger on specified table to call the specified function with supplied parameters.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method databaseVersion

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    databaseVersion: (options?: QueryInterfaceOptions) => Promise<string>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Return database version

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method deferConstraints

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    deferConstraints: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    transaction: Transaction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Defer constraints

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method describeTable

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    describeTable: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | { schema?: string | undefined; tableName?: string | undefined },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    schema?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    schemaDelimeter?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Describe a table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method dropAllEnums

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    dropAllEnums: (options?: QueryOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Drops all defined enums

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method dropAllSchemas

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    dropAllSchemas: (options?: QueryInterfaceOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Drops all tables.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method dropAllTables

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    dropAllTables: (options?: QueryOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Drops all tables.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method dropFunction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    dropFunction: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    functionName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    params: any[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Postgres only. Drops a function

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method dropSchema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    dropSchema: (schema?: string, options?: QueryInterfaceOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Drops the specified schema (table).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The schema to query. Applies only to Postgres.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method dropTable

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    dropTable: (tableName: string, options?: QueryOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Drops the specified table.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter tableName

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Table name.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Query options, particularly "force".

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method dropTrigger

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    dropTrigger: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    triggerName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Postgres only. Drops the specified trigger.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method escape

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    escape: (value?: string | number | Date) => string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Escape a value (e.g. a string, number or date)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method getForeignKeysForTables

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    getForeignKeysForTables: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableNames: string[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Returns all foreign key constraints of each table in list

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method increment

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    increment: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    instance: Instance<any>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    values: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    identifier: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Increments a row value

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method insert

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    insert: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    instance: Instance<any>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    values: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Inserts a new record

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method nameIndexes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    nameIndexes: (indexes: string[], rawTablename: string) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Put a name to an index

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method quoteIdentifier

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    quoteIdentifier: (identifier: string, force: boolean) => string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Escape an identifier (e.g. a table or attribute name). If force is true, the identifier will be quoted even if the quoteIdentifiers option is false.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method quoteIdentifiers

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    quoteIdentifiers: (identifiers: string, force: boolean) => string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Split an identifier into .-separated tokens and quote each part. If force is true, the identifier will be quoted even if the quoteIdentifiers option is false.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method quoteTable

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    quoteTable: (identifier: string) => string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Escape a table name

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method rawSelect

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    rawSelect: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options: QueryOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attributeSelector: string | string[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    model?: Model<any, any>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<string[]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Selects raw without parsing the string into an object

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method removeColumn

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    removeColumn: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | { tableName?: string | undefined; schema?: string | undefined },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attribute: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Removes a column from a table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method removeConstraint

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    removeConstraint: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    constraintName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Removes constraints from a table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method removeIndex

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    removeIndex: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    indexNameOrAttributes: string[] | string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Removes an index of a table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method renameColumn

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    renameColumn: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | { schema?: string | undefined; tableName?: string | undefined },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attrNameBefore: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    attrNameAfter: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Renames a column

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method renameFunction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    renameFunction: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    oldFunctionName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    params: any[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    newFunctionName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Postgres only. Rename a function

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method renameTable

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    renameTable: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    before: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    after: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Renames a table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method renameTrigger

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    renameTrigger: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    oldTriggerName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    newTriggerName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryInterfaceOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Postgres only. Renames a trigger

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method rollbackTransaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    rollbackTransaction: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    transaction: Transaction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Rollback ( revert ) a transaction that has'nt been commited

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method select

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    select: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    model: Model<any, any>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object[]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Returns selected rows

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method setAutocommit

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    setAutocommit: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    transaction: Transaction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    value: boolean,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Set option for autocommit of a transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method setIsolationLevel

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    setIsolationLevel: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    transaction: Transaction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    value: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Set the isolation level of a transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method showAllSchemas

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    showAllSchemas: (options?: QueryOptions) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Queries all table names in the database.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method showAllTables

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    showAllTables: (options?: QueryOptions) => Promise<string[]>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Returns all tables

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method showIndex

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    showIndex: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string | Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Shows the index of a table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method startTransaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    startTransaction: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    transaction: Transaction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Begin a new transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method update

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    update: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    instance: Instance<any>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    values: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    identifier: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Updates a row

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method upsert

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    upsert: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tableName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    values: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    updateValues: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    model: Model<any, any>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => Promise<Object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Inserts or Updates a record in the database

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface QueryInterfaceOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface QueryInterfaceOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Most of the methods accept options and use only the logger property of the options. That's why the most used interface type for options in a method is separated here as another interface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • A function that gets executed while running the query to log the sql.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    transaction?: Transaction | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • An optional transaction to perform this query in

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface QueryOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface QueryOptions extends SearchPathOptions, ReturningOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Interface for query options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property bind

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    bind?: Object | string[] | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Either an object of named bind parameter in the format $param or an array of unnamed bind parameter to replace $1, $2, ... in your SQL.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property fieldMap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    fieldMap?: { [key: string]: string } | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property instance

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      instance?: Instance<any> | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • A sequelize instance used to build the return instance

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • A function that gets executed while running the query to log the sql.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property mapToModel

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      mapToModel?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Map returned fields to model's fields if options.model or options.instance is present. Mapping will occur before building the model instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property model

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      model?: Model<any, any> | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • A sequelize model used to build the returned model instances (used to be called callee)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property nest

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      nest?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • If true, transforms objects with . separated property names into nested objects using [dottie.js](https://github.com/mickhansen/dottie.js). For example { 'user.username': 'john' } becomes { user: { username: 'john' }}. When nest is true, the query type is assumed to be 'SELECT', unless otherwise specified

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Defaults to false

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property plain

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      plain?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Sets the query type to SELECT and return a single row

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property raw

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      raw?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • If true, sequelize will not try to format the results of the query, or build an instance of a model from the result

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property replacements

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      replacements?: Object | string[] | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Either an object of named parameter replacements in the format :param or an array of unnamed replacements to replace ? in your SQL.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property retry

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      retry?: RetryOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Set of flags that control when a query is automatically retried.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property supportsSearchPath

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      supportsSearchPath?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • If false do not prepend the query with the search_path (Postgres only)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property type

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • The type of query you are executing. The query type affects how results are formatted before they are passed back. The type is a string, but Sequelize.QueryTypes is provided as convenience shortcuts.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property useMaster

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      useMaster?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Force the query to use the write pool, regardless of the query type.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Defaults to false

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface QueryOptionsTransactionRequired

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface QueryOptionsTransactionRequired {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface QueryTypes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface QueryTypes {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property BULKDELETE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          BULKDELETE: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property BULKUPDATE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BULKUPDATE: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property DELETE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              DELETE: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property DESCRIBE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                DESCRIBE: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property FOREIGNKEYS

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  FOREIGNKEYS: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property INSERT

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    INSERT: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property RAW

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      RAW: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property SELECT

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        SELECT: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property SHOWINDEXES

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          SHOWINDEXES: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property SHOWTABLES

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            SHOWTABLES: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property UPDATE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              UPDATE: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property UPSERT

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                UPSERT: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property VERSION

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  VERSION: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface ReplicationOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface ReplicationOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Interface for replication Options in the sequelize constructor

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property read

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    read?:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Array<{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    host?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    port?: string | number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    username?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    password?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    database?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    }>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property write

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      write?:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      host?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      port?: string | number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      username?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      password?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      database?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface RestoreOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface RestoreOptions extends LoggingOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Options for Model.restore

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property hooks

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        hooks?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Run before / after bulk restore hooks?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property individualHooks

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        individualHooks?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • If set to true, restore will find all records within the where parameter and will execute before / after bulkRestore hooks on each row

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property limit

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        limit?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • How many rows to undelete

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        transaction?: Transaction | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Transaction to run query under

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property where

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        where?: AnyWhereOptions | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Filter the restore

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface RetryOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface RetryOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Interface for retry Options in the sequelize constructor and QueryOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Options, QueryOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property match

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        match?: Array<string | RegExp | Error> | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Only retry a query if the error matches one of these strings.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property max

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        max?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • How many times a failing query is automatically retried. Set to 0 to disable retrying on SQL_BUSY error.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface ReturningOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface ReturningOptions {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property returning

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          returning?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Append RETURNING * to get back auto generated values (Postgres only)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface SchemaOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface SchemaOptions extends LoggingOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Schema Options provided for applying a schema to a model

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property schemaDelimeter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          schemaDelimeter?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • The character(s) that separates the schema name from the table name

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface ScopeOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface ScopeOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Scope Options for Model.scope

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property method

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          method: string | any[];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • The scope(s) to apply. Scopes can either be passed as consecutive arguments, or as an array of arguments. To apply simple scopes and scope functions with no arguments, pass them as strings. For scope function, pass an object, with a method property. The value can either be a string, if the method does not take any arguments, or an array, where the first element is the name of the method, and consecutive elements are arguments to that method. Pass null to remove all scopes, including the default.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface SearchPathOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface SearchPathOptions {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property searchPath

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            searchPath?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • An optional parameter to specify the schema search_path (Postgres only)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            transaction?: Transaction | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Transaction to run query under

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface Sequelize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface Sequelize extends SequelizeStaticAndInstance, Hooks<any> {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • This is the main class, the entry point to sequelize. To use it, you just need to import sequelize:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              var Sequelize = require('sequelize');

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              In addition to sequelize, the connection library for the dialect you want to use should also be installed in your project. You don't need to import it however, as sequelize will take care of that.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property models

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            models: ModelsHashInterface;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Defined models.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            options: Options;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Defined options.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property Sequelize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Sequelize: SequelizeStatic;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • A reference to Sequelize constructor from sequelize. Useful for accessing DataTypes, Errors etc.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method authenticate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            authenticate: (options?: QueryOptions) => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Test the connection by trying to authenticate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Query Options for authentication

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method close

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            close: () => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Close all connections used by this sequelize instance, and free all references so the instance can be garbage collected.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Normally this is done on process exit, so you only need to call this method if you are creating multiple instances, and want to garbage collect some of them.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method createSchema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            createSchema: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            schema: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            options: { logging?: boolean | Function | undefined }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Create a new database schema.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note,that this is a schema in the [postgres sense of the word](http://www.postgresql.org/docs/9.1/static/ddl-schemas.html), not a database table. In mysql and sqlite, this command will do nothing.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Name of the schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Options supplied

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              options.logging A function that logs sql queries, or false for no logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method databaseVersion

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            databaseVersion: () => Promise<string>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Returns the database version

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method define

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            define: <TInstance, TAttributes, TCreationAttributes = TAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            modelName: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            attributes: DefineModelAttributes<TCreationAttributes>,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            options?: DefineOptions<TInstance>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => Model<TInstance, TAttributes, TCreationAttributes>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Define a new model, representing a table in the DB.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The table columns are define by the hash that is given as the second argument. Each attribute of the hash represents a column. A short table definition might look like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              sequelize.define('modelName', {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              columnA: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type: Sequelize.BOOLEAN,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              validate: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              is: ["[a-z]",'i'], // will only allow letters
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              max: 23, // only allow values <= 23
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              isIn: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              args: [['en', 'zh']],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              msg: "Must be English or Chinese"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              field: 'column_a'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              // Other attributes here
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              columnB: Sequelize.STRING,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              columnC: 'MY VERY OWN COLUMN TYPE'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              })
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              sequelize.models.modelName // The model will now be available in models under the name given to define

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              As shown above, column definitions can be either strings, a reference to one of the datatypes that are predefined on the Sequelize constructor, or an object that allows you to specify both the type of the column, and other attributes such as default values, foreign key constraints and custom setters and getters.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              For a list of possible data types, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#data-types

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              For more about getters and setters, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#getters-setters

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              For more about instance and class methods, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#expansion-of-models

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              For more about validation, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#validations

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter modelName

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The name of the model. The model will be stored in sequelize.models under this name

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter attributes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              An object, where each attribute is a column of the table. Each column can be either a DataType, a string or a type-description object, with the properties described below:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              These options are merged with the default define options provided to the Sequelize constructor

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method drop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            drop: (options?: DropOptions) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Drop all tables defined through this sequelize instance. This is done by calling Model.drop on each model

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The options passed to each call to Model.drop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • {Model#drop} for options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method dropAllSchemas

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            dropAllSchemas: (options: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            }) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Drop all schemas

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note,that this is a schema in the [postgres sense of the word](http://www.postgresql.org/docs/9.1/static/ddl-schemas.html), not a database table. In mysql and sqlite, this is the equivalent of drop all tables.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Options supplied

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              options.logging A function that logs sql queries, or false for no logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method dropSchema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            dropSchema: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            schema: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            options: { logging?: boolean | Function | undefined }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Drop a single schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note,that this is a schema in the [postgres sense of the word](http://www.postgresql.org/docs/9.1/static/ddl-schemas.html), not a database table. In mysql and sqlite, this drop a table matching the schema name

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Name of the schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Options supplied

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              options.logging A function that logs sql queries, or false for no logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method escape

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            escape: (value: string) => string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Escape value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter value

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Value that needs to be escaped

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method getDialect

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            getDialect: () => string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Returns the specified dialect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method getQueryInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            getQueryInterface: () => QueryInterface;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Returns an instance of QueryInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method import

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            import: <TInstance, TAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            path: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            defineFunction?: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            sequelize: Sequelize,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            dataTypes: DataTypes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => Model<TInstance, TAttributes>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => Model<TInstance, TAttributes>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Imports a model defined in another file

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Imported models are cached, so multiple calls to import with the same path will not load the file multiple times

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              See https://github.com/sequelize/sequelize/blob/master/examples/using-multiple-model-files/Task.js for a short example of how to define your models in separate files so that they can be imported by sequelize.import

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter path

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The path to the file that holds the model you want to import. If the part is relative, it will be resolved relatively to the calling file

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter defineFunction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              An optional function that provides model definitions. Useful if you do not want to use the module root as the define function

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method isDefined

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            isDefined: (modelName: string) => boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Checks whether a model with the given name is defined

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter modelName

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The name of a model defined with Sequelize.define

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method model

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            model: <TInstance, TAttributes>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            modelName: string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => Model<TInstance, TAttributes>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Fetch a Model which is already defined

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter modelName

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The name of a model defined with Sequelize.define

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method query

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            query: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            sql: string | { query: string; values: any[] },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            options?: QueryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Execute a query on the DB, with the posibility to bypass all the sequelize goodness.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              By default, the function will return two arguments: an array of results, and a metadata object, containing number of affected rows etc. Use .spread to access the results.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you are running a type of query where you don't need the metadata, for example a SELECT query, you can pass in a query type to make sequelize format the results:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              sequelize.query('SELECT...').spread(function (results, metadata) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              // Raw query - use spread
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              sequelize.query('SELECT...', { type: sequelize.QueryTypes.SELECT }).then(function (results) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              // SELECT query - use then
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              })

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter sql

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Query options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method random

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            random: () => fn;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Get the fn for random based on the dialect

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method set

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            set: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            variables: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            options: QueryOptionsTransactionRequired
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Execute a query which would set an environment or user variable. The variables are set per connection, so this function needs a transaction.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Only works for MySQL.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter variables

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Object with multiple variables.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Query options.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method showAllSchemas

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            showAllSchemas: (options: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            logging?: boolean | Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            }) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Show all defined schemas

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note,that this is a schema in the [postgres sense of the word](http://www.postgresql.org/docs/9.1/static/ddl-schemas.html), not a database table. In mysql and sqlite, this will show all tables.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Options supplied

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              options.logging A function that logs sql queries, or false for no logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method sync

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            sync: (options?: SyncOptions) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Sync all defined models to the DB.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Sync Options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            transaction: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <T>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            options: TransactionOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            autoCallback: (t: Transaction) => PromiseLike<T>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ): Promise<T>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <T>(autoCallback: (t: Transaction) => PromiseLike<T>): Promise<T>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            (options?: TransactionOptions): Promise<Transaction>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Start a transaction. When using transactions, you should pass the transaction in the options argument in order for the query to happen under that transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              sequelize.transaction().then(function (t) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              return User.find(..., { transaction: t}).then(function (user) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              return user.updateAttributes(..., { transaction: t});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              })
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              .then(t.commit.bind(t))
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              .catch(t.rollback.bind(t));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              })

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              A syntax for automatically committing or rolling back based on the promise chain resolution is also supported:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              sequelize.transaction(function (t) { // Note that we use a callback rather than a promise.then()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              return User.find(..., { transaction: t}).then(function (user) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              return user.updateAttributes(..., { transaction: t});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              }).then(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              // Commited
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              }).catch(function (err) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              // Rolled back
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              console.error(err);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              });

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you have [CLS](https://github.com/othiym23/node-continuation-local-storage) enabled, the transaction will automatically be passed to any query that runs witin the callback. To enable CLS, add it do your project, create a namespace and set it on the sequelize constructor:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              var cls = require('continuation-local-storage'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ns = cls.createNamespace('....');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              var Sequelize = require('sequelize');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Sequelize.cls = ns;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note, that CLS is enabled for all sequelize instances, and all instances will share the same namespace

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Transaction Options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter autoCallback

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Callback for the transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method truncate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            truncate: (options?: DestroyOptions) => Promise<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Truncate all tables defined through the sequelize models. This is done by calling Model.truncate() on each model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The options passed to Model.destroy in addition to truncate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              {Boolean|function} [options.transaction]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              {Boolean|function} [options.logging] A function that logs sql queries, or false for no logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method validate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            validate: (options?: QueryOptions) => Promise<ValidationError>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface SequelizeLoDash

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface SequelizeLoDash extends _.LoDashStatic {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method camelizeIf

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                camelizeIf: (str: string, condition: boolean) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  method compactLite

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  compactLite: <T>(arr: T[]) => T[];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • * Returns an array with some falsy values removed. The values null, "", undefined and NaN are considered falsey.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Parameter arr

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Array to compact.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  method matchesDots

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  matchesDots: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  dots: string | string[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  value: Object
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ) => (item: Object) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method underscoredIf

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    underscoredIf: (str: string, condition: boolean) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface SequelizeStatic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface SequelizeStatic extends SequelizeStaticAndInstance, DataTypes {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Sequelize methods available only for the static class ( basically this is the constructor and some extends )

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property cls

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      cls: any;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Provide access to continuation-local-storage (http://docs.sequelizejs.com/en/latest/api/sequelize/#transactionoptions-promise)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property default

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      default: SequelizeStatic;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Default export for import Sequelize from 'sequelize'; kind of imports

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property Sequelize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Sequelize: SequelizeStatic;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Export sequelize static on the instance for import Sequelize from 'sequelize'; kind of imports

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method useCLS

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      useCLS: (namespace: cls.Namespace) => Sequelize;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        new (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        database: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        username: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        password: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        options?: Options
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ): Sequelize;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Instantiate sequelize with name of database, username and password

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          #### Example usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // without password and options
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          var sequelize = new Sequelize('database', 'username')
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // without options
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          var sequelize = new Sequelize('database', 'username', 'password')
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // without password / with blank password
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          var sequelize = new Sequelize('database', 'username', null, {})
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // with password and options
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          var sequelize = new Sequelize('my_database', 'john', 'doe', {})
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // with uri (see below)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          var sequelize = new Sequelize('mysql://localhost:3306/database', {})

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Parameter database

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The name of the database

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Parameter username

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The username which is used to authenticate against the database.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Parameter password

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The password which is used to authenticate against the database.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          An object with options.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        new (database: string, username: string, options?: Options): Sequelize;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          new (uri: string, options?: Options): Sequelize;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Instantiate sequelize with an URI Sequelize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameter uri

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            A full database URI

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            See above for possible options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          new (options: Options): Sequelize;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Instantiate sequelize with an options object which containing username, password, database Sequelize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameter options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            An object with options. See above for possible options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface SequelizeStaticAndInstance

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface SequelizeStaticAndInstance extends Errors {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Sequelize methods that are available both for the static and the instance class of Sequelize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property Deferrable

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Deferrable: Deferrable;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • A reference to the deferrable collection. Use this to access the different deferrable options.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property Instance

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instance: Instance<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • A reference to the sequelize instance class.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property Model

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Model: Model<any, any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • A Model represents a table in the database. Sometimes you might also see it referred to as model, or simply as factory. This class should not be instantiated directly, it is created using sequelize.define, and already created models can be loaded using sequelize.import

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property Op

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Op: Operators;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Promise: typeof Promise;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • A modified version of bluebird promises, that allows listening for sql events

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property QueryTypes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            QueryTypes: QueryTypes;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Available query types for use with sequelize.query

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property Transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Transaction: TransactionStatic;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • A reference to the sequelize transaction class. Use this to access isolationLevels when creating a transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property Utils

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Utils: Utils;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • A reference to sequelize utilities. Most users will not need to use these utils directly. However, you might want to use Sequelize.Utils._, which is a reference to the lodash library, if you don't already have it imported in your project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property Validator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Validator: Validator;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Exposes the validator.js object, so you can extend it with custom validation functions. The validator is exposed both on the instance, and on the constructor.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method and

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            and: (...args: Array<string | Object>) => and;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • An AND query

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameter args

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Each argument will be joined by AND

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method asIs

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            asIs: (val: any) => literal;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method cast

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              cast: (val: any, type: string) => cast;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Creates a object representing a call to the cast function.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter val

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The value to cast

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter type

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The type to cast it to

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method col

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              col: (col: string) => col;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Creates a object representing a column in the DB. This is often useful in conjunction with sequelize.fn, since raw string arguments to fn will be escaped.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter col

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The name of the column

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method condition

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              condition: (attr: Object, logic: string | Object) => where;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method fn

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                fn: (fn: string, ...args: any[]) => fn;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Creates a object representing a database function. This can be used in search queries, both in where and order parts, and as default values in column definitions. If you want to refer to columns in your function, you should use sequelize.col, so that the columns are properly interpreted as columns and not a strings.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Convert a user's username to upper case

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  instance.updateAttributes({
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  username: self.sequelize.fn('upper', self.sequelize.col('username'))
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  })

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter fn

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The function you want to call

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter args

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  All further arguments will be passed as arguments to the function

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method json

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                json: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                conditionsOrPath: string | Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                value?: string | number | boolean
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ) => json;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Creates an object representing nested where conditions for postgres's json data-type.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter conditionsOrPath

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  A hash containing strings/numbers or other nested hash, a string using dot notation or a string using postgres json syntax.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter value

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  An optional value to compare against. Produces a string of the form "<json path> = ''".

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method literal

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                literal: (val: any) => literal;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Creates a object representing a literal, i.e. something that will not be escaped.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter val

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method or

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                or: (...args: Array<string | Object>) => or;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • An OR query

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter args

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Each argument will be joined by OR

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method where

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                where: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (attr: Object, comparator: string, logic: string | Object): where;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (attr: Object, logic: string | Object): where;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • A way of specifying attr = condition.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The attr can either be an object taken from Model.rawAttributes (for example Model.rawAttributes.id or Model.rawAttributes.name). The attribute should be defined in your model definition. The attribute can also be an object from one of the sequelize utility functions (sequelize.fn, sequelize.col etc.)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  For string attributes, use the regular { where: { attr: something }} syntax. If you don't want your string to be escaped, use sequelize.literal.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter attr

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The attribute, which can be either an attribute object from Model.rawAttributes or a sequelize object, for example an instance of sequelize.fn. For simple string attributes, use the POJO syntax

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter comparator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Comparator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameter logic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The condition. Can be both a simply type, or a further condition (.or, .and, .literal etc.)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                interface SetOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                interface SetOptions {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface SyncOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface SyncOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Sync Options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Sequelize.sync

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property alter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  alter?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Alters tables to fit models. Not recommended for production use. Deletes data in columns that were removed or had their type changed in the model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property force

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  force?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • If force is true, each DAO will do DROP TABLE IF EXISTS ..., before it tries to create its own table

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property hooks

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  hooks?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • If hooks is true then beforeSync, afterSync, beforBulkSync, afterBulkSync hooks will be called

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  logging?: Function | boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • A function that logs sql queries, or false for no logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property match

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  match?: RegExp | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Match a regex against the database name before syncing, a safety check for cases where force: true is used in tests but not live code

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property schema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  schema?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • The schema that the tables should be created in. This can be overriden for each table in sequelize.define

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property searchPath

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  searchPath?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • An optional parameter to specify the schema search_path (Postgres only)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface ThroughOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface ThroughOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Used for a association table in n:m associations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • AssociationOptionsBelongsToMany

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property model

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  model: Model<any, any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • The model used to join both sides of the N:M association.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property scope

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  scope?: AssociationScope | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • A key/value set that will be used for association create and find defaults on the through model. (Remember to add the attributes to the through model)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property unique

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  unique?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • If true a unique key will be generated from the foreign keys used (might want to turn this off and create specific unique keys when using scopes)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Defaults to true

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface TimeoutError

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface TimeoutError extends DatabaseError {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    new (parent: Error): TimeoutError;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Thrown when a database query times out because of a deadlock

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface Transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface Transaction {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • The transaction object is used to identify a running transaction. It is created by calling Sequelize.transaction().

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      To run a query under a transaction, you should pass the transaction in the options object.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property LOCK

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    LOCK: TransactionLock;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Possible options for row locking. Used in conjuction with find calls:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • TransactionStatic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method commit

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    commit: () => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Commit the transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method rollback

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    rollback: () => Promise<void>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Rollback (abort) the transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface TransactionIsolationLevels

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface TransactionIsolationLevels {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Isolations levels can be set per-transaction by passing options.isolationLevel to sequelize.transaction. Default to REPEATABLE_READ but you can override the default isolation level by passing options.isolationLevel in new Sequelize.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property READ_COMMITTED

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    READ_COMMITTED: TransactionIsolationLevelReadCommitted;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property READ_UNCOMMITTED

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      READ_UNCOMMITTED: TransactionIsolationLevelReadUncommitted;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property REPEATABLE_READ

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        REPEATABLE_READ: TransactionIsolationLevelRepeatableRead;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property SERIALIZABLE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          SERIALIZABLE: TransactionIsolationLevelSerializable;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface TransactionLock

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface TransactionLock {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Possible options for row locking. Used in conjuction with find calls:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property KEY_SHARE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            KEY_SHARE: TransactionLockLevelKeyShare;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property NO_KEY_UPDATE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              NO_KEY_UPDATE: TransactionLockLevelNoKeyUpdate;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property SHARE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                SHARE: TransactionLockLevelShare;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property UPDATE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  UPDATE: TransactionLockLevelUpdate;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface TransactionOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface TransactionOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Options provided when the transaction is created

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • sequelize.transaction()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property autocommit

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    autocommit?: boolean | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property deferrable

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      deferrable?: Deferrable[keyof Deferrable] | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Sets the constraints to be deferred or immediately checked.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property isolationLevel

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      isolationLevel?: TransactionIsolationLevel | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • See Sequelize.Transaction.ISOLATION_LEVELS for possible options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property logging

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      logging?: Function | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • A function that gets executed while running the query to log the sql.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      transaction?: Transaction | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Specify the parent transaction so that this transaction is nested or a save point within the parent

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property type

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type?: TransactionType | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • See Sequelize.Transaction.TYPES for possible options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface TransactionStatic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface TransactionStatic {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • The transaction static object

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property ISOLATION_LEVELS

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ISOLATION_LEVELS: TransactionIsolationLevels;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Isolations levels can be set per-transaction by passing options.isolationLevel to sequelize.transaction. Default to REPEATABLE_READ but you can override the default isolation level by passing options.isolationLevel in new Sequelize.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The possible isolations levels to use when starting a transaction:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        READ_UNCOMMITTED: "READ UNCOMMITTED",
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        READ_COMMITTED: "READ COMMITTED",
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        REPEATABLE_READ: "REPEATABLE READ",
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        SERIALIZABLE: "SERIALIZABLE"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Pass in the desired level as the first argument:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        return sequelize.transaction({
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        isolationLevel: Sequelize.Transaction.SERIALIZABLE
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }, function (t) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // your transactions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }).then(function(result) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // transaction has been committed. Do something after the commit if required.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }).catch(function(err) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // do something with the err.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        });

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • ISOLATION_LEVELS

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property LOCK

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      LOCK: TransactionLock;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Possible options for row locking. Used in conjuction with find calls:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        t1 // is a transaction
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        t1.LOCK.UPDATE,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        t1.LOCK.SHARE,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        t1.LOCK.KEY_SHARE, // Postgres 9.3+ only
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        t1.LOCK.NO_KEY_UPDATE // Postgres 9.3+ only

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Usage:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        t1 // is a transaction
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Model.findAll({
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        where: ...,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        transaction: t1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        lock: t1.LOCK...
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        });

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Postgres also supports specific locks while eager loading by using OF:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        UserModel.findAll({
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        where: ...,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        include: [TaskModel, ...],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        transaction: t1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        lock: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        level: t1.LOCK...,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        of: UserModel
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        });

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        UserModel will be locked but TaskModel won't!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property TYPES

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      TYPES: TransactionTypes;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Transaction type can be set per-transaction by passing options.type to sequelize.transaction. Default to DEFERRED but you can override the default isolation level by passing options.transactionType in new Sequelize.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The transaction types to use when starting a transaction:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        DEFERRED: "DEFERRED",
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        IMMEDIATE: "IMMEDIATE",
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        EXCLUSIVE: "EXCLUSIVE"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Pass in the transaction type the first argument:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        return sequelize.transaction({
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type: Sequelize.Transaction.EXCLUSIVE
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }, function (t) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // your transactions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }).then(function(result) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // transaction has been committed. Do something after the commit if required.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }).catch(function(err) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // do something with the err.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        });

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Sequelize.Transaction.TYPES

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface TransactionTypes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface TransactionTypes {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Transaction type can be set per-transaction by passing options.type to sequelize.transaction. Default to DEFERRED but you can override the default isolation level by passing options.transactionType in new Sequelize.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property DEFERRED

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      DEFERRED: TransactionTypeDeferred;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property EXCLUSIVE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        EXCLUSIVE: TransactionTypeExclusive;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property IMMEDIATE

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          IMMEDIATE: TransactionTypeImmediate;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface TruncateOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface TruncateOptions extends LoggingOptions, SearchPathOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The options passed to Model.destroy in addition to truncate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property cascade

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            cascade?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Only used in conjuction with TRUNCATE. Truncates all tables that have foreign-key references to the named table, or to any tables added to the group due to CASCADE.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to false;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property force

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            force?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Delete instead of setting deletedAt to current timestamp (only applicable if paranoid is enabled)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Defaults to false;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface UniqueConstraintError

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface UniqueConstraintError extends ValidationError {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              new (options: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              parent?: Error | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              message?: string | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              errors?: Object | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              }): UniqueConstraintError;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Thrown when a unique constraint is violated in the database

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface UpdateOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface UpdateOptions extends FieldsOptions, LoggingOptions, ReturningOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Options used for Model.update

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property hooks

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              hooks?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Run before / after bulk update hooks?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Defaults to true

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property individualHooks

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              individualHooks?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Run before / after update hooks?. If true, this will execute a SELECT followed by individual UPDATEs. A select is needed, because the row data needs to be passed to the hooks

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Defaults to false

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property limit

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              limit?: number | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • How many rows to update (only for mysql and mariadb)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property sideEffects

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              sideEffects?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Whether or not to update the side effects of any virtual setters.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Defaults to true

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property silent

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              silent?: boolean | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • If true, the updatedAt timestamp will not be updated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property transaction

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              transaction?: Transaction | undefined;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Transaction to run query under

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property where

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              where: AnyWhereOptions;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Options to describe the scope of the search.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface UpsertOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface UpsertOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              extends FieldsOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              LoggingOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              SearchPathOptions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ReturningOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Options for Model.upsert method

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface Utils

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface Utils {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property and

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                and: andStatic;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property cast

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  cast: castStatic;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property col

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    col: colStatic;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property fn

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      fn: fnStatic;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property json

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        json: jsonStatic;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property literal

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          literal: literalStatic;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property mergeDefaults

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            mergeDefaults: typeof _.merge;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Same concept as _.merge, but don't overwrite properties that have already been assigned

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property or

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            or: orStatic;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Promise: typeof Promise;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property where

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                where: whereStatic;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  method addTicks

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  addTicks: (s: string, tickChar?: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method argsArePrimaryKeys

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    argsArePrimaryKeys: (args: any[], primaryKeys: Object) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method camelize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      camelize: (str: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        method canTreatArrayAsAnd

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        canTreatArrayAsAnd: (arr: any[]) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          method cloneDeep

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          cloneDeep: <T extends Object>(obj: T, fn?: (value: T) => any) => T;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method combineTableNames

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            combineTableNames: (tableName1: string, tableName2: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method defaultValueSchemable

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              defaultValueSchemable: (value: any) => boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Determine if the default value provided exists and can be described in a db schema using the DEFAULT directive.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method format

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              format: (arr: any[], dialect?: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method formatNamedParameters

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                formatNamedParameters: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                sql: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                parameters: any,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                dialect?: string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  method formatReferences

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  formatReferences: (obj: Object) => Object;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method inherit

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    inherit: (subClass: Object, superClass: Object) => Object;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method lowercaseFirst

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      lowercaseFirst: (str: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        method mapOptionFieldNames

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        mapOptionFieldNames: <T extends Object>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        options: T,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Model: Model<any, any, any>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ) => T;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          method mapValueFieldNames

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          mapValueFieldNames: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          dataValues: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          fields: string[],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Model: Model<any, any, any>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ) => Object;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method now

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            now: (dialect: string) => Date;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method pluralize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              pluralize: (s: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method removeCommentsFromFunctionString

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                removeCommentsFromFunctionString: (s: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  method removeNullValuesFromHash

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  removeNullValuesFromHash: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  hash: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  omitNull?: boolean,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  options?: Object
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ) => any;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method removeTicks

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    removeTicks: (s: string, tickChar?: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method singularize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      singularize: (s: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        method sliceArgs

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        sliceArgs: (args: any[], begin?: number) => any[];

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          method spliceStr

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          spliceStr: (str: string, index: number, count: number, add: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method stack

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            stack: () => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method tick

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              tick: (f: Function) => void;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method toDefaultValue

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                toDefaultValue: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (value: DataTypeAbstract): any;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (value: () => DataTypeAbstract): any;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  method uppercaseFirst

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  uppercaseFirst: (str: string) => string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method validateParameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    validateParameter: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    value: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    expectation: Object,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    options?: Object
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface ValidationError

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface ValidationError extends BaseError {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property errors

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        errors: ValidationErrorItem[];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Array of ValidationErrorItem objects describing the validation errors

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        method get

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        get: (path: string) => ValidationErrorItem[];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Gets all validation error items for the path / field specified.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Parameter path

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The path to be checked for error items

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        new (message: string, errors?: ValidationErrorItem[]): ValidationError;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Validation Error. Thrown when the sequelize validation has failed. The error contains an errors property, which is an array with 1 or more ValidationErrorItems, one for each validation that failed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Parameter message

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Error message

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Parameter errors

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Array of ValidationErrorItem objects describing the validation errors

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface ValidationErrorItem

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface ValidationErrorItem extends BaseError {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property message

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          message: string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • An error message

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property path

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          path: string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • The field that triggered the validation error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property type

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type: string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • The type of the validation error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property value

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          value: string;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • The value that generated the error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          new (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          message: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          path: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          value: string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ): ValidationErrorItem;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Validation Error Item Instances of this class are included in the ValidationError.errors property.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameter message

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            An error message

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameter type

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The type of the validation error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameter path

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The field that triggered the validation error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameter value

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The value that generated the error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface Validator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface Validator extends ValidatorJSType {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Validator Interface

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          method contains

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          contains: (str: string, element: string[]) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method is

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            is: (str: string, pattern: string, modifiers: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method isDecimal

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              isDecimal: (str: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method isIPv4

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                isIPv4: (str: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  method isIPv6

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  isIPv6: (str: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method isUrl

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    isUrl: (str: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method len

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      len: (str: string, min: number, max: number) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        method max

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        max: (str: string, val: number) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          method min

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          min: (str: string, val: number) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method not

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            not: (str: string, pattern: string, modifiers: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method notContains

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              notContains: (str: string, element: string[]) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method notEmpty

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                notEmpty: (str: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  method notIn

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  notIn: (str: string, values: string[]) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method notRegex

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    notRegex: (str: string, pattern: string, modifiers: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method regex

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      regex: (str: string, pattern: string, modifiers: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface where

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface where {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property attribute

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          attribute: Object;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property comparator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            comparator?: string | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property logic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              logic: string | Object;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                interface WhereGeometryOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                interface WhereGeometryOptions {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Where Geometry Options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property coordinates

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                coordinates: Array<number[] | number>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property type

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface WhereNested

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface WhereNested {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Where Complex nested query

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property $and

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    $and: Array<AnyWhereOptions | WhereLogic>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property $or

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $or: Array<AnyWhereOptions | WhereLogic>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface WherePGStatement

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface WherePGStatement {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Nested where Postgre Statement

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property $all

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        $all: Array<string | number>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property $any

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          $any: Array<string | number>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface whereStatic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface whereStatic {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              new (attr: Object, comparator: string, logic: string | Object): where;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • A way of specifying attr = condition.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The attr can either be an object taken from Model.rawAttributes (for example Model.rawAttributes.id or Model.rawAttributes.name). The attribute should be defined in your model definition. The attribute can also be an object from one of the sequelize utility functions (sequelize.fn, sequelize.col etc.)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                For string attributes, use the regular { where: { attr: something }} syntax. If you don't want your string to be escaped, use sequelize.literal.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter attr

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The attribute, which can be either an attribute object from Model.rawAttributes or a sequelize object, for example an instance of sequelize.fn. For simple string attributes, use the POJO syntax

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter comparator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Comparator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameter logic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The condition. Can be both a simply type, or a further condition (.or, .and, .literal etc.)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              construct signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              new (attr: Object, logic: string | Object): where;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Type Aliases

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                type AddConstraintOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                type AddConstraintOptions =
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | AddUniqueConstraintOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | AddDefaultConstraintOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | AddCheckConstraintOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | AddPrimaryKeyConstraintOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | AddForeignKeyConstraintOptions;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type AnyFindOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type AnyFindOptions = FindOptions<any>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type DefineModelAttributes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type DefineModelAttributes<T> = {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    /**
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    * The description of a database column for model
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    */
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [P in keyof T]: string | DataTypeAbstract | DefineAttributeColumnOptions;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Interface for Attributes provided for a column

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      See Also

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Sequelize.define

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type FindOptionsAttributesArray

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type FindOptionsAttributesArray = Array<
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | literal
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | [string, string]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | fn
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | [fn, string]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | cast
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | [cast, string]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | [literal, string]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    >;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Shortcut for types used in FindOptions.attributes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type FindOptionsOrderArray

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type FindOptionsOrderArray = Array<
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | number
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Model<any, any>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | { model: Model<any, any>; as?: string | undefined }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | fn
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    >;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Shortcut for order type in FindOptions.attributes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type IndexType

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type IndexType = 'UNIQUE' | 'FULLTEXT' | 'SPATIAL';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type OperatorsAliases

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type OperatorsAliases = Partial<{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [key: string]: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $eq: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $ne: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $gte: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $gt: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $lte: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $lt: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $not: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $in: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notIn: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $is: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $like: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notLike: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $iLike: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notILike: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $regexp: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notRegexp: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $iRegexp: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notIRegexp: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $between: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notBetween: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $overlap: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $contains: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $contained: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $adjacent: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $strictLeft: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $strictRight: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $noExtendRight: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $noExtendLeft: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $and: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $or: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $any: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $all: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $values: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $col: symbol;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $raw: symbol; // deprecated remove by v5.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      }>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type Primitives

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type Primitives = string | number | boolean | Buffer;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • A hash of attributes to describe your search. See above for examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          We did put Object in the end, because there where query might be a JSON Blob. It cripples a bit the typesafety, but there is no way to pass the tests if we just remove it.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type TransactionIsolationLevel

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type TransactionIsolationLevel =
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | TransactionIsolationLevelReadUncommitted
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | TransactionIsolationLevelReadCommitted
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | TransactionIsolationLevelRepeatableRead
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | TransactionIsolationLevelSerializable;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type TransactionIsolationLevelReadCommitted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type TransactionIsolationLevelReadCommitted = 'READ COMMITTED';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type TransactionIsolationLevelReadUncommitted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type TransactionIsolationLevelReadUncommitted = 'READ UNCOMMITTED';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type TransactionIsolationLevelRepeatableRead

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type TransactionIsolationLevelRepeatableRead = 'REPEATABLE READ';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                type TransactionIsolationLevelSerializable

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                type TransactionIsolationLevelSerializable = 'SERIALIZABLE';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type TransactionLockLevel

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type TransactionLockLevel =
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | TransactionLockLevelUpdate
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | TransactionLockLevelShare
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | TransactionLockLevelKeyShare
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | TransactionLockLevelNoKeyUpdate;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type TransactionLockLevelKeyShare

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type TransactionLockLevelKeyShare = 'KEY SHARE';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type TransactionLockLevelNoKeyUpdate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type TransactionLockLevelNoKeyUpdate = 'NO KEY UPDATE';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type TransactionLockLevelShare

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type TransactionLockLevelShare = 'SHARE';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type TransactionLockLevelUpdate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type TransactionLockLevelUpdate = 'UPDATE';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type TransactionType

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type TransactionType =
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | TransactionTypeDeferred
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | TransactionTypeImmediate
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | TransactionTypeExclusive;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type TransactionTypeDeferred

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type TransactionTypeDeferred = 'DEFERRED';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                type TransactionTypeExclusive

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                type TransactionTypeExclusive = 'EXCLUSIVE';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type TransactionTypeImmediate

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type TransactionTypeImmediate = 'IMMEDIATE';

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type ValidatorJSType

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type ValidatorJSType = typeof ValidatorJS;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type WhereLogic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type WhereLogic = Partial<{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $ne: string | number | WhereLogic | null;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $in: Array<string | number> | literal;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $not: boolean | string | number | AnyWhereOptions | null;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notIn: Array<string | number> | literal;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $gte: number | string | Date;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $gt: number | string | Date;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $lte: number | string | Date;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $lt: number | string | Date;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $like: string | WherePGStatement;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $iLike: string | WherePGStatement;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $ilike: string | WherePGStatement;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notLike: string | WherePGStatement;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notILike: string | WherePGStatement;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $between: [number, number] | [Date, Date];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      '..': [number, number] | [string, string];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $notBetween: [number, number];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      '!..': [number, number] | [string, string];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $overlap: [number, number] | [string, string];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      '&&': [number, number];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $contains: any;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      '@>': any;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $contained: any;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      '<@': any;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      }>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Logic of where statement

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type WhereOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type WhereOptions<T> = {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [P in keyof T]?:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Primitives
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Primitives[]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | WhereLogic
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | (T[P] extends Primitives ? null : WhereOptions<T[P]>)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | col
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | or
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | WhereGeometryOptions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | WhereNested
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | where
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | null;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Package Files (1)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Dependencies (4)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Dev Dependencies (0)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        No dev dependencies.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Peer Dependencies (0)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        No peer dependencies.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Badge

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/sequelize.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Markdown
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/sequelize)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • HTML
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          <a href="https://www.jsdocs.io/package/@types/sequelize"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>