'use strict' module.exports = (sequelize, DataTypes) => { var registrationhook = sequelize.define('registrationhook', { id: { allowNull: false, autoIncrement: true, primaryKey: true, type: DataTypes.INTEGER }, sortvalue: DataTypes.INTEGER, type: DataTypes.STRING, script: { allowNull: true, type: DataTypes.BLOB } }, { timestamps: false }) registrationhook.associate = function (models) { var RegistrationhookXGroup = sequelize.define('registrationhook_x_group', {}, { timestamps: false, freezeTableName: true }) registrationhook.belongsToMany(models.group, { as: 'groups', through: RegistrationhookXGroup, foreignKey: 'registraionhookId', otherKey: 'groupId' }) } return registrationhook }