feat: 独立admin的模块
This commit is contained in:
@@ -49,7 +49,7 @@ RouterCodeModel.init(
|
||||
},
|
||||
key: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
allowNull: true,
|
||||
},
|
||||
active: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
@@ -72,12 +72,12 @@ RouterCodeModel.init(
|
||||
defaultValue: RouterCodeType.route,
|
||||
},
|
||||
middleware: {
|
||||
type: DataTypes.ARRAY(DataTypes.STRING),
|
||||
type: DataTypes.JSON,
|
||||
defaultValue: [],
|
||||
},
|
||||
next: {
|
||||
type: DataTypes.STRING,
|
||||
defaultValue: '',
|
||||
type: DataTypes.JSON,
|
||||
defaultValue: {},
|
||||
},
|
||||
data: {
|
||||
type: DataTypes.JSON,
|
||||
@@ -94,11 +94,24 @@ RouterCodeModel.init(
|
||||
paranoid: true,
|
||||
},
|
||||
);
|
||||
// RouterCodeModel 检测不存在,不存在则创建
|
||||
RouterCodeModel.sync({ alter: true, logging: false })
|
||||
.then((res) => {
|
||||
console.log('RouterCodeModel sync', res);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error('RouterCodeModel sync', e);
|
||||
console.error('RouterCodeModel sync', e.message);
|
||||
RouterCodeModel.sync({ force: true })
|
||||
.then((res) => {
|
||||
console.log('RouterCodeModel force sync', res);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error('RouterCodeModel force sync error');
|
||||
});
|
||||
});
|
||||
// RouterCodeModel.sync({force: true});
|
||||
|
||||
export const TableIsExist = async () => {
|
||||
// 判断cf_router_code表是否存在
|
||||
const tableIsExist = await sequelize.getQueryInterface().showAllTables();
|
||||
return tableIsExist.includes('cf_router_code');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user