@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).

                                                                                                                                                                                                                                                                                                                                    pro