refactor: 统一代码风格并迁移至 ESLint 新配置
style(backend): 格式化模型文件代码 style(frontend): 调整组件代码格式 chore: 删除旧 ESLint 配置并添加新配置 refactor(backend): 重构模型定义语法 style: 统一箭头函数和对象属性简写
This commit is contained in:
@@ -8,22 +8,23 @@ async function ensureSchema() {
|
||||
|
||||
if (dbType === 'sqlite') {
|
||||
// Check if nicId column exists in device_ports
|
||||
const [columns] = await sequelize.query("PRAGMA table_info(device_ports)");
|
||||
const [columns] = await sequelize.query('PRAGMA table_info(device_ports)');
|
||||
const hasNicId = columns.some(col => col.name === 'nicId');
|
||||
|
||||
if (!hasNicId) {
|
||||
console.log('Adding nicId column to device_ports...');
|
||||
await sequelize.query('ALTER TABLE device_ports ADD COLUMN nicId VARCHAR(255) NULL REFERENCES network_cards(nicId)');
|
||||
await sequelize.query(
|
||||
'ALTER TABLE device_ports ADD COLUMN nicId VARCHAR(255) NULL REFERENCES network_cards(nicId)'
|
||||
);
|
||||
console.log('Added nicId column.');
|
||||
} else {
|
||||
console.log('nicId column already exists in device_ports.');
|
||||
}
|
||||
} else if (dbType === 'mysql') {
|
||||
const [columns] = await sequelize.query(
|
||||
"SHOW COLUMNS FROM `device_ports` LIKE 'nicId'",
|
||||
{ type: QueryTypes.SELECT }
|
||||
);
|
||||
|
||||
const [columns] = await sequelize.query("SHOW COLUMNS FROM `device_ports` LIKE 'nicId'", {
|
||||
type: QueryTypes.SELECT,
|
||||
});
|
||||
|
||||
if (columns.length === 0) {
|
||||
console.log('Adding nicId column to device_ports...');
|
||||
await sequelize.query(
|
||||
|
||||
Reference in New Issue
Block a user