From ee3459d66ecf7877be26dc4c2f09782ae53c89ca Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Sun, 30 Aug 2020 22:07:37 +0200 Subject: [PATCH] Made the JDBC Schema name customizable --- .../com/helger/phoss/smp/backend/sql/SMPJDBCConfiguration.java | 1 + .../helger/phoss/smp/backend/sql/mgr/SMPManagerProviderSQL.java | 2 +- phoss-smp-webapp-sql/src/main/resources/smp-server.properties | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/phoss-smp-backend-sql/src/main/java/com/helger/phoss/smp/backend/sql/SMPJDBCConfiguration.java b/phoss-smp-backend-sql/src/main/java/com/helger/phoss/smp/backend/sql/SMPJDBCConfiguration.java index 6009470ed..96cac8b3b 100644 --- a/phoss-smp-backend-sql/src/main/java/com/helger/phoss/smp/backend/sql/SMPJDBCConfiguration.java +++ b/phoss-smp-backend-sql/src/main/java/com/helger/phoss/smp/backend/sql/SMPJDBCConfiguration.java @@ -33,6 +33,7 @@ public final class SMPJDBCConfiguration public static final String CONFIG_JDBC_URL = "jdbc.url"; public static final String CONFIG_JDBC_USER = "jdbc.user"; public static final String CONFIG_JDBC_PASSWORD = "jdbc.password"; + public static final String CONFIG_JDBC_SCHEMA = "jdbc.schema"; public static final String CONFIG_TARGET_DATABASE = "target-database"; @Since ("5.0.6") diff --git a/phoss-smp-backend-sql/src/main/java/com/helger/phoss/smp/backend/sql/mgr/SMPManagerProviderSQL.java b/phoss-smp-backend-sql/src/main/java/com/helger/phoss/smp/backend/sql/mgr/SMPManagerProviderSQL.java index 55f2aa903..b212f8e7d 100644 --- a/phoss-smp-backend-sql/src/main/java/com/helger/phoss/smp/backend/sql/mgr/SMPManagerProviderSQL.java +++ b/phoss-smp-backend-sql/src/main/java/com/helger/phoss/smp/backend/sql/mgr/SMPManagerProviderSQL.java @@ -79,7 +79,7 @@ public void beforeInitManagers () .baselineVersion ("1") .baselineDescription ("SMP 5.2.x database layout, MySQL only") .locations ("db/migrate-" + m_eDBType.getID ()) - .schemas ("smp") + .schemas (aCF.getAsString (SMPJDBCConfiguration.CONFIG_JDBC_SCHEMA, "smp")) /* * Avoid scanning the ClassPath by * enumerating them explicitly diff --git a/phoss-smp-webapp-sql/src/main/resources/smp-server.properties b/phoss-smp-webapp-sql/src/main/resources/smp-server.properties index fb2cbba9a..06aaf0456 100644 --- a/phoss-smp-webapp-sql/src/main/resources/smp-server.properties +++ b/phoss-smp-webapp-sql/src/main/resources/smp-server.properties @@ -90,6 +90,7 @@ jdbc.driver = com.mysql.cj.jdbc.Driver jdbc.url = jdbc:mysql://localhost:3306/smp?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC jdbc.user = smp jdbc.password = smp +jdbc.schema = smp target-database = MySQL # PostgreSQL example @@ -97,6 +98,7 @@ target-database = MySQL #jdbc.url = jdbc:postgresql://localhost:5432/smp #jdbc.user = smp #jdbc.password = smp +#jdbc.schema = smp #target-database = PostgreSQL ## Warn if JDBC execution time is exceeded? (since 5.0.6)