Create a new instance of the associated model and associate it with this.
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...
}
The values used to create the association.
Options passed to create
and add
. Can also hold additional attributes for the join table.
Generated using TypeDoc
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... }
http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/
Instance