Duansg commented on code in PR #3735:
URL: https://github.com/apache/hertzbeat/pull/3735#discussion_r2322843177


##########
hertzbeat-manager/src/main/resources/db/migration/h2/V174__update_column.sql:
##########
@@ -0,0 +1,29 @@
+-- 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
+
+CREATE TABLE IF NOT EXISTS hzb_metrics_favorite (
+    id BIGINT AUTO_INCREMENT PRIMARY KEY,
+    creator VARCHAR(255) NOT NULL,
+    monitor_id BIGINT NOT NULL,
+    metrics_name VARCHAR(255) NOT NULL,
+    create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+
+-- Create unique index for hzb_metrics_favorite table
+CREATE UNIQUE INDEX IF NOT EXISTS uk_monitor_metrics ON hzb_metrics_favorite 
(creator, monitor_id, metrics_name);

Review Comment:
   > hi the upgrade sql is not necessary, due the table will be auto created by 
jpa.
   
   Hi, @tomsun28 thank you for your review. I added the upgrade script for 
version control purposes, as it provides better documentation of certain table 
management operations. While JPA can automatically create tables, I believe it 
cannot replace Flyway's version management capabilities.
   
   If you don't think this is a good idea, I can delete it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@hertzbeat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@hertzbeat.apache.org
For additional commands, e-mail: notifications-h...@hertzbeat.apache.org

Reply via email to