shippings_config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* indent size: 2 */
  2. module.exports = app => {
  3. const DataTypes = app.Sequelize;
  4. const Model = app.model.define('ShippingsConfig', {
  5. shipping_id: {
  6. type: DataTypes.INTEGER(10).UNSIGNED,
  7. allowNull: false,
  8. primaryKey: true,
  9. autoIncrement: true
  10. },
  11. shipping_name: {
  12. type: DataTypes.STRING(255),
  13. allowNull: true
  14. },
  15. shipping_logo: {
  16. type: DataTypes.STRING(255),
  17. allowNull: true
  18. },
  19. shipping_params_index: {
  20. type: DataTypes.STRING(255),
  21. allowNull: true
  22. },
  23. shipping_status: {
  24. type: DataTypes.INTEGER(1).UNSIGNED,
  25. allowNull: true
  26. },
  27. shipping_sort: {
  28. type: DataTypes.INTEGER(1).UNSIGNED,
  29. allowNull: true
  30. },
  31. admin_id: {
  32. type: DataTypes.INTEGER(10).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_shippings_config'
  45. });
  46. Model.associate = function() {
  47. //关联管理员表
  48. Model.belongsTo(app.model.AdminUser,{foreignKey:'admin_id',targetKey:'admin_id',as:'admin_user'});
  49. }
  50. //同步:没有就新建,有就不变
  51. Model.sync();
  52. return Model;
  53. };