Ver código fonte

1、修复升级程序未兼容overlayfs导致数据库的问题补丁

JianXin 11 meses atrás
pai
commit
59a88dd789

+ 3 - 3
buildPatch.php

@@ -4,13 +4,13 @@ date_default_timezone_set('PRC');
 
 require_once __DIR__.'/Patch.php';
 
-$codeDir = __DIR__.'/patch/rewrite_the_schedule';
+$codeDir = __DIR__.'/patch/repair_overlayfs_database';
 
 $code = file_get_contents($codeDir . '/code.php');
 $code = str_replace('<?php', '', $code);
 
-$name = '重写Zone和Sensor Group的日程表';
-$desc = '主要用于修复Zone和Sensor Group日程重复的Bug';
+$name = '修复升级程序导致的数据库问题';
+$desc = '主要用于修复升级程序未兼容overlayfs导致数据库的问题';
 // 适用于此版本及以下版本使用
 $ver = '999';
 // 补丁key

+ 109 - 0
patch/repair_overlayfs_database/code.php

@@ -0,0 +1,109 @@
+<?php
+
+$data = [
+    "ALTER TABLE gateways ADD COLUMN bluetooth_ver Text;",
+    "ALTER TABLE sensors ADD COLUMN device_type Text;",
+    "ALTER TABLE sensors ADD COLUMN brightness Text;",
+    "ALTER TABLE temp_lamp ADD COLUMN version Text;",
+    "ALTER TABLE sensor_pattern ADD COLUMN addr Text;",
+    "ALTER TABLE zones ADD COLUMN exec_scene Text;",
+    "ALTER TABLE zones ADD COLUMN exec_mode Text;",
+    "ALTER TABLE zones ADD COLUMN jump Text;",
+    "ALTER TABLE groups ADD COLUMN pattern_id Text;",
+    "ALTER TABLE gateways ADD COLUMN app_ver Text;",
+    "ALTER TABLE groups ADD COLUMN jump integer;",
+    "ALTER TABLE devices ADD COLUMN jump integer;",
+    "ALTER TABLE groups ADD disable_range_state int default 2;",
+    "ALTER TABLE scenes ADD jump_group_set Text;",
+    "alter table sensors add fade_time integer default 0;",
+    "alter table groups add fade_time integer default 0;",
+    "alter table linkdsc add gwid integer default 0;",
+    "alter table sensors add illumination_sensitivity integer default 6;",
+    "alter table sensors add pir_sensitivity integer default 6;",
+    "alter table gateways add ap_disabled integer default 0;",
+    "alter table gateways add hop integer default 3;",
+    "alter table gateways add dimming integer default 100;",
+    "alter table gateways add old integer default 0;",
+    "alter table sensor_pattern add color_temperature text default 4000;",
+    "alter table gateways add ble_status integer default 1 not null;",
+    "alter table devices add color_mode integer default 1 not null;",
+    "alter table devices add color_x integer default 1 not null;",
+    "alter table devices add color_y integer default 1 not null;",
+    "alter table devices add color_fine integer default 0 not null;",
+    "alter table groups add color_mode integer default 1 not null;",
+    "alter table groups add color_x integer default 1 not null;",
+    "alter table groups add color_y integer default 1 not null;",
+    "alter table groups add color_fine integer default 0 not null;",
+    "alter table sensor_pattern add color_mode integer default 1 not null;",
+    "alter table sensor_pattern add color_x integer default 1 not null;",
+    "alter table sensor_pattern add color_y integer default 1 not null;",
+    "alter table sensor_pattern add color_fine integer default 0 not null;",
+    "alter table sensor_pattern add type integer default 1 not null;",
+    "alter table gateways add android_id text default '';",
+    "alter table zones add jump_exec_scene integer default 0;",
+    "alter table devices add input_control integer default 1;",
+    "alter table sensor_pattern add illuminance_lux integer default 700 not null;",
+    "alter table groups add demand_color_mode integer default 1 not null;",
+    "alter table groups add demand_color_x integer default 1 not null;",
+    "alter table groups add demand_color_y integer default 1 not null;",
+    "alter table groups add demand_color_fine integer default 0 not null;",
+    "alter table sensor_pattern add old_lux integer default 1 not null;",
+    "alter table gateways add android_old_id text default '' not null;",
+    "alter table controls add fade_type int default 1 not null;",
+    "alter table groups add export int default 0 not null;",
+    "alter table zones add export int default 0 not null;",
+    "alter table scenes add export int default 0 not null;",
+    "alter table scene_schedule_tables add export int default 0 not null;",
+    "alter table sensor_schedule_tables add export int default 0 not null;",
+    "alter table sensor_pattern add export int default 0 not null;",
+    "alter table devices add up_set int default 0 not null;",
+    "alter table groups add exec_pattern_id int;",
+    "alter table groups add before_dimming int default 50 not null;",
+    "alter table zones add manual int default 0;",
+    "alter table scene_schedule_tables add sun_start_scene_id text;",
+    "alter table scene_schedule_tables add sun_end_scene_id text;",
+    "alter table scene_schedule_tables add sun_start_time text;",
+    "alter table scene_schedule_tables add sun_end_time text;",
+    "alter table gateways add dim_switch text default '';",
+    "alter table scene_schedule_tables add sun_start_revision_time integer default 0 not null;",
+    "alter table scene_schedule_tables add sun_end_revision_time integer default 0 not null;",
+    "alter table gateways add dimming_revert integer default 0 not null;",
+    "alter table date_sync_log add type integer default 0 not null;",
+    "alter table date_sync_log add status integer default 0 not null;",
+    "alter table date_sync_log add zone text default '' not null;",
+    "alter table zones add remote_control_scene_id integer default 0 not null;",
+    "alter table zones add demand_scene_id integer default 0 not null;",
+    "alter table zones add schedule_fade_switch integer default 0 not null;",
+    "alter table zones add schedule_fade_time integer default 0 not null;",
+    "alter table sensor_pattern add out_color_temperature text default '' not null;",
+    "alter table sensor_pattern add fade_time integer default 0 not null;",
+    "alter table gateways add gw_hop integer default 3 not null;",
+    "alter table sensor_pattern add not_in_fade_time integer default 0;",
+    "alter table sensors add rf_sensitivity integer default 5;",
+    "alter table sensor_pattern add not_in_color_temperature text default 4000;",
+    "alter table sensor_pattern add not_in_color_mode integer default 1;",
+    "alter table sensor_pattern add not_in_color_x integer default 1;",
+    "alter table sensor_pattern add not_in_color_y integer default 1;",
+    "alter table sensor_pattern add not_in_color_fine integer default 0;",
+    "alter table scenes add missing integer default 0 not null;",
+    "alter table scene_schedule_tables add missing integer default 0 not null;",
+    "alter table zones add missing_days integer default 0;",
+    "alter table sensor_pattern add missing integer default 0 not null;",
+    "alter table sensor_schedule_tables add missing integer default 0 not null;",
+    "alter table sensor_pattern add not_in_color_fine integer default 0;",
+    "alter table zones add restore_status integer default 1;",
+    "alter table groups add restore_status integer default 1;",
+    "alter table sensor_pattern add sensor_status integer default 1;",
+    "alter table zones add missing_mode integer default 0 not null;",
+    "alter table sensors add work_mode integer;"
+];
+
+foreach ($data as $v){
+    $ok = sqlite('')->exec($v);
+    printing_l('执行:['.$v.'] '.($ok? '成功': '失败'));
+}
+
+//$lowerDir = realpath(__DIR__.'/../../smartLEDZ');
+//// write层
+//$upperDir = realpath(__DIR__.'/../../smartLEDZ_Upper');
+//exec('cp -r '.$lowerDir.'/upgrade'.' ' . $upperDir.'/');

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
patch/rewrite_the_schedule/2024-01-24v0_17060610729806.b


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
patch/rewrite_the_schedule/2024-01-24v999_17060610799436.b


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff