product_comment.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* indent size: 2 */
  2. module.exports = app => {
  3. const DataTypes = app.Sequelize;
  4. const Model = app.model.define('ProductComment', {
  5. comment_id: {
  6. type: DataTypes.INTEGER(10).UNSIGNED,
  7. allowNull: false,
  8. primaryKey: true,
  9. autoIncrement: true
  10. },
  11. product_rate: {
  12. type: DataTypes.INTEGER(1).UNSIGNED,
  13. allowNull: true
  14. },
  15. order_id: {
  16. type: DataTypes.INTEGER(10).UNSIGNED,
  17. allowNull: true
  18. },
  19. product_id: {
  20. type: DataTypes.INTEGER(10).UNSIGNED,
  21. allowNull: true
  22. },
  23. comment: {
  24. type: DataTypes.STRING(255),
  25. allowNull: true
  26. },
  27. user_id: {
  28. type: DataTypes.INTEGER(10).UNSIGNED,
  29. allowNull: true
  30. },
  31. status: {
  32. type: DataTypes.INTEGER(1).UNSIGNED,
  33. allowNull: true
  34. },
  35. update_time: {
  36. type: DataTypes.TIME,
  37. allowNull: true,
  38. },
  39. create_time: {
  40. type: DataTypes.DATE,
  41. allowNull: true
  42. }
  43. }, {
  44. tableName: 'szj_product_comment'
  45. });
  46. Model.associate = function() {
  47. Model.belongsTo(app.model.Users,{foreignKey:'user_id',targetKey:'user_id',as:'users'});
  48. }
  49. //同步:没有就新建,有就不变
  50. Model.sync();
  51. return Model;
  52. };