LandingSite Smartools 1.0升级到1.1升级说明
1. 数据库
Smartools从1.0版本升级到1.1版本数据库迁移脚本。
1.1. 丢弃所有业务数据
drop table `Tools`;
drop table `MaintainceLogs`;
drop table `Attachments`;
drop table `Tags`;
-- drop table `Settings`;
Settings
表不建议建议删除或清空,如果清空需要重新在界面上配置。
1.2. 增量更新
1.2.1. 表结构变更
alter table `MaintainceLogs` rename `MaintenanceLogs`;
alter table `MaintenanceLogs` change column `maintainceType` `maintenanceType` tinyint;
alter table `Tools` change column `maintainceType` `maintenanceType` integer;
alter table `Tools` change column `maintainceFreq1` `maintenanceFreq1` integer;
alter table `Tools` change column `maintainceFreq2` `maintenanceFreq2` integer;
alter table `Tags` add column `lastPacketTS` timestamp after `id`;
1.2.2. 保留Tool与Tag绑定关系
如果Tool
已经绑定了Tag
,建议先将Tool
.inhouseId
、Tag
.id
的绑定数据导出用于数据割接。
select Tools.inhouseId, Tags.id from `Tags`, `Tools` where Tags.ToolId=Tools.id;
update `Tags` set `ToolId`=(select `id` from `Tools` where `inhouseId`='FLBB00664') where id = 'c12142000010';
1.2.3. 数据清空
update `Tools` set maintainedOn1 = null, maintainedOn2 = null;
delete from `MaintenanceLogs`;
delete from `Attachment`;
update `Tags` set ToolId = null;
2. 升级系统
1.1版本backend和frontend都有更新。可以通过docker-compose升级。
cd /opt/data
ls -l
docker-compose down
docker-compose pull
docker-compose up -d
docker-compose logs smartools-backend