'use strict' module.exports = (sequelize, DataTypes) => { var registrationhook = sequelize.define('registrationhook', { id: { allowNull: false, autoIncrement: true, primaryKey: true, type: DataTypes.INTEGER }, name: DataTypes.STRING, description: DataTypes.STRING(2048), sortvalue: DataTypes.INTEGER, type: DataTypes.STRING, script: { allowNull: true, type: DataTypes.BLOB, get () { var blob = this.getDataValue('script') return blob ? blob.toString() : '' } } }, { 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: 'registrationhookId', otherKey: 'groupId' }) } return registrationhook }