1.0.367.sql 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. -- WP-SD5: persist automatic effectiveness evaluation and audit log.
  2. SET @auto_sql := IF(
  3. (SELECT COUNT(*) FROM information_schema.COLUMNS
  4. WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='ado_smart_ops_improvement_plan'
  5. AND COLUMN_NAME='AutoVerifyResult')=0,
  6. 'ALTER TABLE `ado_smart_ops_improvement_plan` ADD COLUMN `AutoVerifyResult` VARCHAR(32) NULL',
  7. 'SELECT 1');
  8. PREPARE auto_stmt FROM @auto_sql;
  9. EXECUTE auto_stmt;
  10. DEALLOCATE PREPARE auto_stmt;
  11. SET @autoj_sql := IF(
  12. (SELECT COUNT(*) FROM information_schema.COLUMNS
  13. WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='ado_smart_ops_improvement_plan'
  14. AND COLUMN_NAME='AutoVerifyJson')=0,
  15. 'ALTER TABLE `ado_smart_ops_improvement_plan` ADD COLUMN `AutoVerifyJson` TEXT NULL',
  16. 'SELECT 1');
  17. PREPARE autoj_stmt FROM @autoj_sql;
  18. EXECUTE autoj_stmt;
  19. DEALLOCATE PREPARE autoj_stmt;
  20. SET @autot_sql := IF(
  21. (SELECT COUNT(*) FROM information_schema.COLUMNS
  22. WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='ado_smart_ops_improvement_plan'
  23. AND COLUMN_NAME='AutoVerifyTime')=0,
  24. 'ALTER TABLE `ado_smart_ops_improvement_plan` ADD COLUMN `AutoVerifyTime` DATETIME NULL',
  25. 'SELECT 1');
  26. PREPARE autot_stmt FROM @autot_sql;
  27. EXECUTE autot_stmt;
  28. DEALLOCATE PREPARE autot_stmt;
  29. CREATE TABLE IF NOT EXISTS `ado_smart_ops_improvement_verify_log` (
  30. `id` BIGINT NOT NULL AUTO_INCREMENT,
  31. `tenant_id` BIGINT NOT NULL,
  32. `plan_id` BIGINT NOT NULL,
  33. `auto_result` VARCHAR(32) NULL,
  34. `manual_result` VARCHAR(32) NULL,
  35. `remark` TEXT NULL,
  36. `operator_user_id` BIGINT NULL,
  37. `create_time` DATETIME NOT NULL,
  38. PRIMARY KEY (`id`),
  39. KEY `idx_improve_verify_log` (`tenant_id`,`plan_id`,`create_time`)
  40. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;