12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- /* indent size: 2 */
- module.exports = app => {
- const DataTypes = app.Sequelize;
- const Model = app.model.define('ProductComment', {
- comment_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- primaryKey: true,
- autoIncrement: true
- },
- product_rate: {
- type: DataTypes.INTEGER(1).UNSIGNED,
- allowNull: true
- },
- order_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: true
- },
- product_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: true
- },
- comment: {
- type: DataTypes.STRING(255),
- allowNull: true
- },
- user_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: true
- },
- status: {
- type: DataTypes.INTEGER(1).UNSIGNED,
- allowNull: true
- },
- update_time: {
- type: DataTypes.TIME,
- allowNull: true,
- },
- create_time: {
- type: DataTypes.DATE,
- allowNull: true
- }
- }, {
- tableName: 'szj_product_comment'
- });
- Model.associate = function() {
- Model.belongsTo(app.model.Users,{foreignKey:'user_id',targetKey:'user_id',as:'users'});
- }
- //同步:没有就新建,有就不变
- Model.sync();
- return Model;
- };
|