const { Model } = require('sequelize'); module.exports = (sequelize, DataTypes) => { class Comment extends Model { /** * Helper method for defining associations. * This method is not a part of Sequelize lifecycle. * The `models/index` file will call this method automatically. */ static associate(models) { /* define association here */ } } Comment.init({ commentId: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false }, body: { type: DataTypes.TEXT, allowNull: false } }, { sequelize, timestamps: false, modelName: 'Comment', tableName: 'comment', createdAt: true, updatedAt: true }); Comment.prototype.toJSONFor = function () { return { commentId: this.commentId, body: this.body }; }; return Comment; };