From c01ac876b992290a3d1936839f2e3207c8d23347 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Wed, 6 Dec 2023 22:50:03 +0800 Subject: [PATCH] rename the init.h2.sql to avoid loading wrong files in quick start mode (#5034) ## What's the purpose of this PR rename the init.h2.sql to avoid loading wrong files in quick start mode ## Which issue(s) this PR fixes: Fixes #5033 ## Brief changelog add database prefix to the init.h2.sql files. --- .../ctrip/framework/apollo/biz/service/BizDBPropertySource.java | 2 +- .../main/resources/jpa/{init.h2.sql => configdb.init.h2.sql} | 0 .../framework/apollo/portal/service/PortalDBPropertySource.java | 2 +- .../main/resources/jpa/{init.h2.sql => portaldb.init.h2.sql} | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename apollo-configservice/src/main/resources/jpa/{init.h2.sql => configdb.init.h2.sql} (100%) rename apollo-portal/src/main/resources/jpa/{init.h2.sql => portaldb.init.h2.sql} (100%) diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/BizDBPropertySource.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/BizDBPropertySource.java index 17128cd51bf..43190b06edb 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/BizDBPropertySource.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/BizDBPropertySource.java @@ -67,7 +67,7 @@ public BizDBPropertySource(final ServerConfigRepository serverConfigRepository, @PostConstruct public void runSqlScript() throws Exception { if (env.acceptsProfiles(Profiles.of("h2"))) { - Resource resource = new ClassPathResource("jpa/init.h2.sql"); + Resource resource = new ClassPathResource("jpa/configdb.init.h2.sql"); if (resource.exists()) { DatabasePopulatorUtils.execute(new ResourceDatabasePopulator(resource), dataSource); } diff --git a/apollo-configservice/src/main/resources/jpa/init.h2.sql b/apollo-configservice/src/main/resources/jpa/configdb.init.h2.sql similarity index 100% rename from apollo-configservice/src/main/resources/jpa/init.h2.sql rename to apollo-configservice/src/main/resources/jpa/configdb.init.h2.sql diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalDBPropertySource.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalDBPropertySource.java index b5431bcb1e6..664e6b37e5b 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalDBPropertySource.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalDBPropertySource.java @@ -63,7 +63,7 @@ public PortalDBPropertySource(final ServerConfigRepository serverConfigRepositor @PostConstruct public void runSqlScript() throws Exception { if (env.acceptsProfiles(Profiles.of("h2"))) { - Resource resource = new ClassPathResource("jpa/init.h2.sql"); + Resource resource = new ClassPathResource("jpa/portaldb.init.h2.sql"); if (resource.exists()) { DatabasePopulatorUtils.execute(new ResourceDatabasePopulator(resource), dataSource); } diff --git a/apollo-portal/src/main/resources/jpa/init.h2.sql b/apollo-portal/src/main/resources/jpa/portaldb.init.h2.sql similarity index 100% rename from apollo-portal/src/main/resources/jpa/init.h2.sql rename to apollo-portal/src/main/resources/jpa/portaldb.init.h2.sql