UNPKG

swagelize

Version:

Generate Sequelize model definitions and DAO from a Swagger 2.0 schema

19 lines (16 loc) 520 B
module.exports = function(sequelize, DataTypes) { var Tag = sequelize.define('Tag', { id: { type: DataTypes.BIGINT, format: 'int64', allowNull: false, primaryKey: true, autoIncrement: true }, name: { type: DataTypes.STRING, allowNull: true } }, { tableName: 'Tag', timestamps: false }); Tag.associate = function (models) { models.Tag.belongsToMany(models.Pet, {as: 'tags',through : {model:models.PetTag, unique:false},foreignKey: 'id_tag',otherKey: 'id_pet'}); }; return Tag; };