
const Sequelize = require("sequelize");
// 菜单表
module.exports = (db) => {
  return db.define("sys_menu", {
  // 菜单名称
    name: {
      type: Sequelize.STRING(100),
      allowNull: false,
      defaultValue: "",
  },
  // 父id
    parent_id: {
      type: Sequelize.INTEGER(11).UNSIGNED,
      allowNull: true,
      defaultValue: 0,
  },
  // 图标
    icon: {
      type: Sequelize.STRING(100),
      allowNull: false,
      defaultValue: "",
  },
    path: {
      type: Sequelize.STRING(255),
      allowNull: false,
      defaultValue: "",
  },

  // 菜单类型   "菜单", "页面", "外链", "功能"
    type: {
      type: Sequelize.STRING(255),
      allowNull: false,
      defaultValue: "页面",
  },
  //模型id
    model_id: {
      type: Sequelize.INTEGER(11).UNSIGNED,
      allowNull: true,
      defaultValue: 0,
  },

  //表单id
    form_id: {
      type: Sequelize.INTEGER(11).UNSIGNED,
      allowNull: true,
      defaultValue: 0,
  },

  // 组件地址
    component: {
      type: Sequelize.STRING(100),
      allowNull: false,
      defaultValue: "",
  },

  // api地址
    api_path: {
      type: Sequelize.STRING(100),
      allowNull: false,
      defaultValue: "",
  },
  // 是否显示在菜单中
    is_show_menu: {
      type: Sequelize.INTEGER(1),
      allowNull: false,
      defaultValue: true,
  },
    is_show: {
      type: Sequelize.INTEGER(1),
      allowNull: false,
      defaultValue: true,
  },

  // 菜单类型
    sort: {
      type: Sequelize.INTEGER(11),
      allowNull: false,
      defaultValue: "0",
  },
  });
};


