product_carousels.js 842 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* indent size: 2 */
  2. module.exports = app => {
  3. const DataTypes = app.Sequelize;
  4. const Model = app.model.define('ProductCarousels', {
  5. carousel_id: {
  6. type: DataTypes.INTEGER(10).UNSIGNED,
  7. primaryKey: true,
  8. autoIncrement: true
  9. },
  10. content: {
  11. type: DataTypes.TEXT,
  12. allowNull: true
  13. },
  14. admin_id: {
  15. type: DataTypes.INTEGER(10).UNSIGNED,
  16. allowNull: true
  17. },
  18. update_time: {
  19. type: DataTypes.TIME,
  20. },
  21. create_time: {
  22. type: DataTypes.DATE,
  23. allowNull: true
  24. }
  25. }, {
  26. tableName: 'szj_product_carousels'
  27. });
  28. Model.associate = function() {
  29. //关联管理员表
  30. Model.belongsTo(app.model.AdminUser,{foreignKey:'admin_id',targetKey:'admin_id',as:'admin_user'});
  31. }
  32. //同步:没有就新建,有就不变
  33. Model.sync();
  34. return Model;
  35. };