const { DataTypes } = require('sequelize'); const connect = require('./connect'); /* type: DataTypes.STRING, allowNull: false, defaultValue:'', comment: '名', */ const model = connect.define( __filename.slice(__dirname.length + 1).replace('.js', ''), { id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, comment: 'id', }, name: { type: DataTypes.STRING, allowNull: false, defaultValue: '', comment: '类型名称', }, }, { comment: '常见问题类型', hooks: { beforeFind(option) { if (!option.order) { option.order = [['id', 'ASC']]; } }, }, } ); module.exports = model;