style(backend): 格式化模型文件代码 style(frontend): 调整组件代码格式 chore: 删除旧 ESLint 配置并添加新配置 refactor(backend): 重构模型定义语法 style: 统一箭头函数和对象属性简写
43 lines
966 B
JavaScript
43 lines
966 B
JavaScript
const { sequelize } = require('../db');
|
|
|
|
async function updateSystemFields() {
|
|
try {
|
|
console.log('开始更新系统字段标记...');
|
|
|
|
// 系统字段列表
|
|
const systemFields = [
|
|
'deviceId',
|
|
'name',
|
|
'type',
|
|
'model',
|
|
'serialNumber',
|
|
'rackId',
|
|
'position',
|
|
'height',
|
|
'powerConsumption',
|
|
'status',
|
|
'purchaseDate',
|
|
'warrantyExpiry',
|
|
'ipAddress',
|
|
'description',
|
|
];
|
|
|
|
// 更新系统字段标记
|
|
for (const fieldName of systemFields) {
|
|
const [result] = await sequelize.query(
|
|
`UPDATE deviceFields SET isSystem = 1 WHERE fieldName = '${fieldName}'`,
|
|
{ type: sequelize.QueryTypes.RAW }
|
|
);
|
|
console.log(`标记系统字段: ${fieldName}`);
|
|
}
|
|
|
|
console.log('系统字段标记更新完成');
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('更新失败:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
updateSystemFields();
|