1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- /* indent size: 2 */
- module.exports = app => {
- const DataTypes = app.Sequelize;
- const Model = app.model.define('ArticlesCategory', {
- category_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- primaryKey: true,
- autoIncrement: true
- },
- category_name: {
- type: DataTypes.STRING(200),
- },
- category_desc: {
- type: DataTypes.STRING(255),
- },
- category_image: {
- type: DataTypes.STRING(255),
- },
- pid: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- },
- category_sort: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- },
- category_status: {
- type: DataTypes.INTEGER(1).UNSIGNED,
- },
- category_level: {
- type: DataTypes.INTEGER(1).UNSIGNED,
- },
- category_recommend: {
- type: DataTypes.INTEGER(1).UNSIGNED,
- },
- admin_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- },
- update_time: {
- type: DataTypes.TIME,
- },
- create_time: {
- type: DataTypes.DATE,
- }
- }, {
- tableName: 'szj_articles_category'
- });
- Model.associate = function() {
- //关联角色表
- Model.belongsTo(app.model.AdminUser,{foreignKey:'admin_id',targetKey:'admin_id',as:'admin_user'});
- }
- //同步:没有就新建,有就不变
- Model.sync();
- return Model;
- };
|