feat(耗材): 增强耗材日志名称同步和导入功能

This commit is contained in:
zhang1106
2026-04-10 12:02:06 +08:00
parent 9421e34147
commit 618633bc6a
6 changed files with 1330 additions and 548 deletions
+17
View File
@@ -113,6 +113,11 @@ const migrations = [
'为 consumable_logs 表添加 deviceId、deviceName、rackId、rackName、roomId、roomName 字段',
migrate: migrateConsumableLogDeviceAssociation,
},
{
name: '耗材日志名称同步',
description: '为 consumable_logs 表添加 lastNameSyncAt 字段,支持名称同步',
migrate: migrateConsumableLogNameSync,
},
];
async function runMigrations() {
@@ -845,6 +850,18 @@ async function migrateConsumableLogDeviceAssociation() {
console.log(' 耗材日志设备关联迁移完成');
}
async function migrateConsumableLogNameSync() {
const tableName = 'consumable_logs';
if (!(await tableExists(tableName))) {
console.log(` ${tableName} 表不存在,跳过`);
return;
}
await addColumnIfNotExists(tableName, 'lastNameSyncAt', 'DATETIME');
console.log(' 耗材日志名称同步迁移完成');
}
// 执行迁移
runMigrations().catch(error => {
console.error('迁移执行失败:', error);