product_brands.js 924 B

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