This is an automated email from the ASF dual-hosted git repository.

gongchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git


The following commit(s) were added to refs/heads/master by this push:
     new 014a376c3 [refactor] modify message column to TEXT type (#3698)
014a376c3 is described below

commit 014a376c30efa757074373946beb12d72db230a5
Author: DeleiGuo <[email protected]>
AuthorDate: Sat Aug 23 16:57:04 2025 +0800

    [refactor] modify message column to TEXT type (#3698)
    
    Co-authored-by: Calvin <[email protected]>
    Co-authored-by: tomsun28 <[email protected]>
---
 .../db/migration/h2/V173__update_column.sql        | 21 +++++++++
 .../db/migration/mysql/V173__update_column.sql     | 52 ++++++++++++++++++++++
 .../migration/postgresql/V173__update_column.sql   | 23 ++++++++++
 3 files changed, 96 insertions(+)

diff --git 
a/hertzbeat-manager/src/main/resources/db/migration/h2/V173__update_column.sql 
b/hertzbeat-manager/src/main/resources/db/migration/h2/V173__update_column.sql
new file mode 100644
index 000000000..469a4b32f
--- /dev/null
+++ 
b/hertzbeat-manager/src/main/resources/db/migration/h2/V173__update_column.sql
@@ -0,0 +1,21 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+-- ensure every sql can rerun without error
+
+-- Modify message column to TEXT (H2 TEXT is equivalent to CLOB)
+ALTER TABLE HZB_STATUS_PAGE_INCIDENT_CONTENT ALTER COLUMN message CLOB;
diff --git 
a/hertzbeat-manager/src/main/resources/db/migration/mysql/V173__update_column.sql
 
b/hertzbeat-manager/src/main/resources/db/migration/mysql/V173__update_column.sql
new file mode 100644
index 000000000..196ce0dd5
--- /dev/null
+++ 
b/hertzbeat-manager/src/main/resources/db/migration/mysql/V173__update_column.sql
@@ -0,0 +1,52 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+-- ensure every sql can rerun without error
+
+-- Modify hzb_status_page_incident_content table columns to TEXT type to 
resolve MySQL row size limit issue
+
+DELIMITER //
+CREATE PROCEDURE ModifyStatusIncidentContentColumns()
+BEGIN
+    DECLARE table_exists INT;
+    DECLARE col_exists INT;
+
+    -- Check if the table exists
+    SELECT COUNT(*) INTO table_exists 
+    FROM INFORMATION_SCHEMA.TABLES 
+    WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 
'HZB_STATUS_PAGE_INCIDENT_CONTENT';
+    
+    IF table_exists = 1 THEN
+        -- Check and modify message column to TEXT
+        SELECT COUNT(*) INTO col_exists 
+        FROM INFORMATION_SCHEMA.COLUMNS 
+        WHERE TABLE_SCHEMA = DATABASE() 
+        AND TABLE_NAME = 'HZB_STATUS_PAGE_INCIDENT_CONTENT'
+        AND COLUMN_NAME = 'message'
+        AND DATA_TYPE != 'text';
+        
+        IF col_exists = 1 THEN
+            ALTER TABLE HZB_STATUS_PAGE_INCIDENT_CONTENT MODIFY COLUMN message 
TEXT;
+        END IF;
+    END IF;
+END //
+
+DELIMITER ;
+
+CALL ModifyStatusIncidentContentColumns();
+DROP PROCEDURE IF EXISTS ModifyStatusIncidentContentColumns;
+COMMIT;
\ No newline at end of file
diff --git 
a/hertzbeat-manager/src/main/resources/db/migration/postgresql/V173__update_column.sql
 
b/hertzbeat-manager/src/main/resources/db/migration/postgresql/V173__update_column.sql
new file mode 100644
index 000000000..16836c2aa
--- /dev/null
+++ 
b/hertzbeat-manager/src/main/resources/db/migration/postgresql/V173__update_column.sql
@@ -0,0 +1,23 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+-- ensure every sql can rerun without error
+
+-- Modify message column to TEXT
+ALTER TABLE HZB_STATUS_PAGE_INCIDENT_CONTENT ALTER COLUMN message TYPE TEXT;
+
+commit;
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to