1.8.0-1.9.0.sql 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. ALTER TABLE t_session_record DROP PRIMARY KEY, ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
  2. ALTER TABLE t_task ADD f_run_port INT;
  3. ALTER TABLE t_task ADD f_kill_status BOOL NOT NULL DEFAULT FALSE;
  4. ALTER TABLE t_task ADD f_error_report TEXT;
  5. DROP PROCEDURE IF EXISTS alter_trackingmetric;
  6. DELIMITER //
  7. CREATE PROCEDURE alter_trackingmetric()
  8. BEGIN
  9. DECLARE done BOOL DEFAULT FALSE;
  10. DECLARE date_ CHAR(8);
  11. DECLARE cur CURSOR FOR SELECT RIGHT(TABLE_NAME, 8) FROM INFORMATION_SCHEMA.TABLES
  12. WHERE TABLE_SCHEMA = (SELECT DATABASE()) AND TABLE_NAME LIKE 't\_tracking\_metric\_%';
  13. DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
  14. OPEN cur;
  15. loop_: LOOP
  16. FETCH cur INTO date_;
  17. IF done THEN
  18. LEAVE loop_;
  19. END IF;
  20. SET @sql = CONCAT(
  21. 'ALTER TABLE t_tracking_metric_', date_,
  22. ' MODIFY f_component_name VARCHAR(30) NOT NULL,',
  23. ' ADD INDEX trackingmetric_', date_, '_f_component_name (f_component_name),',
  24. ' DROP INDEX trackingmetric_', date_, '_f_task_id,',
  25. ' DROP INDEX trackingmetric_', date_, '_f_task_version,',
  26. ' MODIFY f_role VARCHAR(10) NOT NULL,',
  27. ' DROP INDEX trackingmetric_', date_, '_f_party_id,',
  28. ' MODIFY f_metric_namespace VARCHAR(80) NOT NULL,',
  29. ' ADD INDEX trackingmetric_', date_, '_f_metric_namespace (f_metric_namespace),',
  30. ' MODIFY f_metric_name VARCHAR(80) NOT NULL,',
  31. ' ADD INDEX trackingmetric_', date_, '_f_metric_name (f_metric_name);'
  32. );
  33. PREPARE stmt FROM @sql;
  34. EXECUTE stmt;
  35. DEALLOCATE PREPARE stmt;
  36. END LOOP;
  37. CLOSE cur;
  38. END //
  39. DELIMITER ;
  40. CALL alter_trackingmetric();
  41. DROP PROCEDURE alter_trackingmetric;
  42. ALTER TABLE t_machine_learning_model_info DROP f_description;
  43. ALTER TABLE t_machine_learning_model_info DROP f_job_status;
  44. ALTER TABLE t_machine_learning_model_info ADD f_archive_sha256 VARCHAR(100);
  45. ALTER TABLE t_machine_learning_model_info ADD f_archive_from_ip VARCHAR(100);
  46. DROP PROCEDURE IF EXISTS alter_componentsummary;
  47. DELIMITER //
  48. CREATE PROCEDURE alter_componentsummary()
  49. BEGIN
  50. DECLARE done BOOL DEFAULT FALSE;
  51. DECLARE date_ CHAR(8);
  52. DECLARE cur CURSOR FOR SELECT RIGHT(TABLE_NAME, 8) FROM INFORMATION_SCHEMA.TABLES
  53. WHERE TABLE_SCHEMA = (SELECT DATABASE()) AND TABLE_NAME LIKE 't\_component\_summary\_%';
  54. DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
  55. OPEN cur;
  56. loop_: LOOP
  57. FETCH cur INTO date_;
  58. IF done THEN
  59. LEAVE loop_;
  60. END IF;
  61. SET @sql = CONCAT('ALTER TABLE t_component_summary_', date_, ' MODIFY f_component_name VARCHAR(50) NOT NULL;');
  62. PREPARE stmt FROM @sql;
  63. EXECUTE stmt;
  64. DEALLOCATE PREPARE stmt;
  65. END LOOP;
  66. CLOSE cur;
  67. END //
  68. DELIMITER ;
  69. CALL alter_componentsummary();
  70. DROP PROCEDURE alter_componentsummary;
  71. DROP TABLE t_model_operation_log;
  72. CREATE TABLE t_server_registry_info (
  73. id INT NOT NULL AUTO_INCREMENT,
  74. f_create_time BIGINT,
  75. f_create_date DATETIME,
  76. f_update_time BIGINT,
  77. f_update_date DATETIME,
  78. f_server_name VARCHAR(30) NOT NULL,
  79. f_host VARCHAR(30) NOT NULL,
  80. f_port INT NOT NULL,
  81. f_protocol VARCHAR(10) NOT NULL,
  82. PRIMARY KEY (id),
  83. INDEX serverregistryinfo_f_server_name (f_server_name)
  84. );
  85. CREATE TABLE t_service_registry_info (
  86. f_create_time BIGINT,
  87. f_create_date DATETIME,
  88. f_update_time BIGINT,
  89. f_update_date DATETIME,
  90. f_server_name VARCHAR(30) NOT NULL,
  91. f_service_name VARCHAR(30) NOT NULL,
  92. f_url VARCHAR(100) NOT NULL,
  93. f_method VARCHAR(10) NOT NULL,
  94. f_params LONGTEXT,
  95. f_data LONGTEXT,
  96. f_headers LONGTEXT,
  97. PRIMARY KEY (f_server_name, f_service_name)
  98. );
  99. CREATE TABLE t_site_key_info (
  100. f_create_time BIGINT,
  101. f_create_date DATETIME,
  102. f_update_time BIGINT,
  103. f_update_date DATETIME,
  104. f_party_id VARCHAR(10) NOT NULL,
  105. f_key_name VARCHAR(10) NOT NULL,
  106. f_key LONGTEXT NOT NULL,
  107. PRIMARY KEY (f_party_id, f_key_name)
  108. );
  109. CREATE TABLE t_pipeline_component_meta (
  110. id INT NOT NULL AUTO_INCREMENT,
  111. f_create_time BIGINT,
  112. f_create_date DATETIME,
  113. f_update_time BIGINT,
  114. f_update_date DATETIME,
  115. f_model_id VARCHAR(100) NOT NULL,
  116. f_model_version VARCHAR(100) NOT NULL,
  117. f_role VARCHAR(50) NOT NULL,
  118. f_party_id VARCHAR(10) NOT NULL,
  119. f_component_name VARCHAR(100) NOT NULL,
  120. f_component_module_name VARCHAR(100) NOT NULL,
  121. f_model_alias VARCHAR(100) NOT NULL,
  122. f_model_proto_index LONGTEXT,
  123. f_run_parameters LONGTEXT,
  124. f_archive_sha256 VARCHAR(100),
  125. f_archive_from_ip VARCHAR(100),
  126. PRIMARY KEY (id),
  127. INDEX pipelinecomponentmeta_f_model_id (f_model_id),
  128. INDEX pipelinecomponentmeta_f_model_version (f_model_version),
  129. INDEX pipelinecomponentmeta_f_role (f_role),
  130. INDEX pipelinecomponentmeta_f_party_id (f_party_id),
  131. INDEX pipelinecomponentmeta_f_component_name (f_component_name),
  132. INDEX pipelinecomponentmeta_f_model_alias (f_model_alias),
  133. UNIQUE INDEX (f_model_id, f_model_version, f_role, f_party_id, f_component_name)
  134. );