From 276ffd0c4a39af3378b47529f9714f3e3e24aedc Mon Sep 17 00:00:00 2001 From: helongfei Date: Wed, 13 Jul 2022 11:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96apppackagehost=E8=A1=A8?= =?UTF-8?q?=E4=B8=BB=E9=94=AE=E7=94=9F=E6=88=90=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/edgegallery/mecm/apm/model/MecHost.java | 3 +-- src/main/java/org/edgegallery/mecm/apm/service/DbService.java | 2 ++ .../resources/db/migration/V1__Add_App_Package_Task_Table.sql | 2 +- src/test/resources/V1__Add_App_Package_Task_Table.sql | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/edgegallery/mecm/apm/model/MecHost.java b/src/main/java/org/edgegallery/mecm/apm/model/MecHost.java index 1b6473c..99454c5 100644 --- a/src/main/java/org/edgegallery/mecm/apm/model/MecHost.java +++ b/src/main/java/org/edgegallery/mecm/apm/model/MecHost.java @@ -36,9 +36,8 @@ import lombok.Setter; public final class MecHost { @Id - @GeneratedValue @Column(name = "id") - private int id; + private String id; @Column(name = "pkg_host_key") private String pkgHostKey; diff --git a/src/main/java/org/edgegallery/mecm/apm/service/DbService.java b/src/main/java/org/edgegallery/mecm/apm/service/DbService.java index 7dc999a..2d18c74 100644 --- a/src/main/java/org/edgegallery/mecm/apm/service/DbService.java +++ b/src/main/java/org/edgegallery/mecm/apm/service/DbService.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Optional; +import java.util.UUID; import org.edgegallery.mecm.apm.exception.ApmException; import org.edgegallery.mecm.apm.model.ApmTenant; import org.edgegallery.mecm.apm.model.AppPackage; @@ -272,6 +273,7 @@ public class DbService { } else { host.setDistributionStatus(mecHostDto.getStatus()); } + host.setId(UUID.randomUUID().toString()); host.setHostIp(mecHostDto.getHostIp()); host.setAppPkgId(appPackageDto.getAppPkgId()); host.setTenantId(tenantId); diff --git a/src/main/resources/db/migration/V1__Add_App_Package_Task_Table.sql b/src/main/resources/db/migration/V1__Add_App_Package_Task_Table.sql index 9ed31dd..0223295 100644 --- a/src/main/resources/db/migration/V1__Add_App_Package_Task_Table.sql +++ b/src/main/resources/db/migration/V1__Add_App_Package_Task_Table.sql @@ -17,7 +17,7 @@ ); create table if not exists apppackagehost ( - id INT GENERATED BY DEFAULT AS IDENTITY, + id varchar(255) not null, pkg_host_key varchar(255) not null, host_ip varchar(255) not null, app_pkg_id varchar(255) not null, diff --git a/src/test/resources/V1__Add_App_Package_Task_Table.sql b/src/test/resources/V1__Add_App_Package_Task_Table.sql index 92429ba..e6978f9 100644 --- a/src/test/resources/V1__Add_App_Package_Task_Table.sql +++ b/src/test/resources/V1__Add_App_Package_Task_Table.sql @@ -17,7 +17,7 @@ ); create table if not exists apppackagehost ( - id INT GENERATED BY DEFAULT AS IDENTITY, + id varchar(255) not null, pkg_host_key varchar(255) not null, host_ip varchar(255) not null, app_pkg_id varchar(255) not null, -- Gitee