weizhouapache commented on code in PR #2479:
URL: https://github.com/apache/cloudstack/pull/2479#discussion_r1890164381
##########
engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java:
##########
@@ -631,6 +635,27 @@ public void check() {
} finally {
lock.releaseRef();
}
+
+ s_logger.info("Running Flyway migration on Cloudstack database");
+ Properties dbProps = DbProperties.getDbProperties();
+ final String cloudUsername = dbProps.getProperty("db.cloud.username");
+ final String cloudPassword = dbProps.getProperty("db.cloud.password");
+ final String cloudHost = dbProps.getProperty("db.cloud.host");
+ final int cloudPort =
Integer.parseInt(dbProps.getProperty("db.cloud.port"));
+ final String dbUrl = "jdbc:mysql://" + cloudHost + ":" + cloudPort +
"/cloud";
+
+ try {
+ Flyway flyway = new Flyway();
+ flyway.setDataSource(dbUrl, cloudUsername, cloudPassword);
+ flyway.setTable("cloudstack_schema_version");
+ flyway.setBaselineOnMigrate(true);
+ flyway.setBaselineVersionAsString("4.11");
Review Comment:
To be tested:
will SQL starts with `4.12` or `4.20` work ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]