12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /* indent size: 2 */
- module.exports = app => {
- const DataTypes = app.Sequelize;
- const Model = app.model.define('Configs', {
- config_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- primaryKey: true,
- autoIncrement: true
- },
- field_index: {
- type: DataTypes.STRING(100)
- },
- field_type: {
- type: DataTypes.STRING(20)
- },
- field_label: {
- type: DataTypes.STRING(20)
- },
- field_group: {
- type: DataTypes.STRING(50)
- },
- field_options: {
- type: DataTypes.STRING(255)
- },
- field_desc: {
- type: DataTypes.STRING(50)
- },
- field_status: {
- type: DataTypes.INTEGER(1).UNSIGNED
- },
- field_value: {
- type: DataTypes.TEXT,
- },
- field_sort: {
- type: DataTypes.INTEGER(10).UNSIGNED
- },
- admin_id: {
- type: DataTypes.INTEGER(10).UNSIGNED
- },
- update_time: {
- type: DataTypes.TIME
- },
- create_time: {
- type: DataTypes.DATE
- }
- }, {
- tableName: 'szj_configs'
- });
- Model.associate = function() {
- //关联管理员表
- Model.belongsTo(app.model.AdminUser,{foreignKey:'admin_id',targetKey:'admin_id',as:'admin_user'});
- }
- //同步:没有就新建,有就不变
- Model.sync();
- return Model;
- };
|