From fcc646391f958167ade7f829bc4fa44cb4b79138 Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Tue, 2 Jun 2026 11:38:07 -0700 Subject: [PATCH 1/4] Add flyway dependency and config. Move db init sql to migration --- pom.xml | 8 ++++++++ .../resources/application-dockerdev-sample.properties | 4 ++++ src/main/resources/application_sample.properties | 2 ++ .../migration/V1__init_schema.sql} | 0 4 files changed, 14 insertions(+) rename src/main/resources/{wise_db_init.sql => db/migration/V1__init_schema.sql} (100%) diff --git a/pom.xml b/pom.xml index 0b07cc732..ca50c647b 100644 --- a/pom.xml +++ b/pom.xml @@ -558,6 +558,14 @@ translate 2.40.15 + + org.flywaydb + flyway-core + + + org.flywaydb + flyway-mysql + UTF-8 diff --git a/src/main/resources/application-dockerdev-sample.properties b/src/main/resources/application-dockerdev-sample.properties index 5138c09bd..86f9eca42 100644 --- a/src/main/resources/application-dockerdev-sample.properties +++ b/src/main/resources/application-dockerdev-sample.properties @@ -17,6 +17,8 @@ server.tomcat.max-http-form-post-size=100MB spring.servlet.multipart.max-file-size=100MB spring.servlet.multipart.max-request-size=100MB +spring.devtools.restart.exclude=db/migration/** + ########## WISE Properties ########## # This section is for portal definitions @@ -97,6 +99,8 @@ spring.redis.pool.max.total=128 #spring.session.redis.flush-mode=on-save # Sessions flush mode. #spring.session.redis.namespace=spring:session # Namespace for keys used to store sessions. +spring.flyway.baseline-on-migrate=true + ######### sendmail properties ########## # This section defines the settings that the portal will use to send mail. diff --git a/src/main/resources/application_sample.properties b/src/main/resources/application_sample.properties index 9c9e4666d..376519772 100644 --- a/src/main/resources/application_sample.properties +++ b/src/main/resources/application_sample.properties @@ -97,6 +97,8 @@ spring.redis.pool.max.total=128 #spring.session.redis.flush-mode=on-save # Sessions flush mode. #spring.session.redis.namespace=spring:session # Namespace for keys used to store sessions. +spring.flyway.baseline-on-migrate=true + ######### sendmail properties ########## # This section defines the settings that the portal will use to send mail. diff --git a/src/main/resources/wise_db_init.sql b/src/main/resources/db/migration/V1__init_schema.sql similarity index 100% rename from src/main/resources/wise_db_init.sql rename to src/main/resources/db/migration/V1__init_schema.sql From 50e914f722a7676e13feb08b6e3c75024e906f39 Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Tue, 2 Jun 2026 13:54:15 -0700 Subject: [PATCH 2/4] Update test to use mysql --- src/test/resources/application.properties | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 8a64760ad..bf5bc4ca6 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -74,27 +74,27 @@ berkeley_cRater_password= # Modify below as needed. # The default settings below is for mysql running on port 3306. # with username "wiseuser", password "wisepass" and schema name "wise_database" -spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=true - -spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE;DATABASE_TO_UPPER=false;mode=mysql -spring.datasource.driver-class-name=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password= -spring.h2.console.enabled=true -spring.h2.console.path=/h2-console +spring.datasource.url=jdbc:mysql://wise-mysql:3306/wise_database?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&useSSL=false +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.username=wiseuser +spring.datasource.password=wisepass -spring.jpa.show-sql=false -spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.properties.hibernate.storage_engine=innodb +spring.jpa.hibernate.ddl-auto=none +spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=true +spring.jpa.hibernate.use-new-id-generator-mappings=false spring.session.store-type=redis -spring.redis.host=localhost +spring.redis.host=wise-redis #spring.redis.password= # Login password of the redis server. spring.redis.port=6379 spring.redis.pool.max.total=128 #spring.session.redis.flush-mode=on-save # Sessions flush mode. #spring.session.redis.namespace=spring:session # Namespace for keys used to store sessions. +spring.flyway.baseline-on-migrate=true + ######### sendmail properties ########## # This section defines the settings that the portal will use to send mail. From 7ebf5cbb3434ebd32e2c7eb61d633651727a17e7 Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Tue, 2 Jun 2026 14:08:13 -0700 Subject: [PATCH 3/4] Revert changes. Use H2. --- src/test/resources/application.properties | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index bf5bc4ca6..8a64760ad 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -74,27 +74,27 @@ berkeley_cRater_password= # Modify below as needed. # The default settings below is for mysql running on port 3306. # with username "wiseuser", password "wisepass" and schema name "wise_database" +spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=true -spring.datasource.url=jdbc:mysql://wise-mysql:3306/wise_database?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&useSSL=false -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.username=wiseuser -spring.datasource.password=wisepass +spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE;DATABASE_TO_UPPER=false;mode=mysql +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= -spring.jpa.properties.hibernate.storage_engine=innodb -spring.jpa.hibernate.ddl-auto=none -spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=true -spring.jpa.hibernate.use-new-id-generator-mappings=false +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console + +spring.jpa.show-sql=false +spring.jpa.hibernate.ddl-auto=create-drop spring.session.store-type=redis -spring.redis.host=wise-redis +spring.redis.host=localhost #spring.redis.password= # Login password of the redis server. spring.redis.port=6379 spring.redis.pool.max.total=128 #spring.session.redis.flush-mode=on-save # Sessions flush mode. #spring.session.redis.namespace=spring:session # Namespace for keys used to store sessions. -spring.flyway.baseline-on-migrate=true - ######### sendmail properties ########## # This section defines the settings that the portal will use to send mail. From 3d6d651cc53a86e86710d36d632648d370f5dbf2 Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Tue, 2 Jun 2026 14:08:22 -0700 Subject: [PATCH 4/4] Disable flyway during test --- src/test/resources/application.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 8a64760ad..2bff59351 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -95,6 +95,8 @@ spring.redis.pool.max.total=128 #spring.session.redis.flush-mode=on-save # Sessions flush mode. #spring.session.redis.namespace=spring:session # Namespace for keys used to store sessions. +spring.flyway.enabled=false + ######### sendmail properties ########## # This section defines the settings that the portal will use to send mail.