UNPKG

swagelize

Version:

Generate Sequelize model definitions and DAO from a Swagger 2.0 schema

20 lines (16 loc) 493 B
module.exports = function(sequelize, DataTypes) { var Category = sequelize.define('Category', { id: { type: DataTypes.BIGINT, format: 'int64', allowNull: false, primaryKey: true, autoIncrement: true }, name: { type: DataTypes.STRING, allowNull: true } }, { tableName: 'Category', timestamps: false }); Category.associate = function (models) { models.Category.hasOne(models.Pet, {foreignKey: 'id_category', onDelete:'CASCADE'}); }; return Category; };