feat: 改为本地数据库 admin的功能
This commit is contained in:
@@ -101,17 +101,21 @@ RouterCodeModel.sync({ alter: true, logging: false })
|
||||
})
|
||||
.catch((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');
|
||||
});
|
||||
if (!TableIsExist()) {
|
||||
RouterCodeModel.sync({ force: true })
|
||||
.then((res) => {
|
||||
console.log('RouterCodeModel force sync', res);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error('RouterCodeModel force sync error');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const TableIsExist = async () => {
|
||||
// 判断cf_router_code表是否存在
|
||||
const tableIsExist = await sequelize.getQueryInterface().showAllTables();
|
||||
const tableIsExist = await sequelize.getQueryInterface().showAllTables({
|
||||
logging: false,
|
||||
});
|
||||
return tableIsExist.includes('cf_router_code');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user