[ https://issues.apache.org/jira/browse/CLOUDSTACK-10278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16390905#comment-16390905 ]
ASF GitHub Bot commented on CLOUDSTACK-10278: --------------------------------------------- ustcweizhou commented on a change in pull request #2479: CLOUDSTACK-10278: Introduce Flyway migration on CloudStack database URL: https://github.com/apache/cloudstack/pull/2479#discussion_r173090330 ########## File path: 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"; Review comment: @rhtyd this is a good question. To be honest, I never considered it. Actually not only me, all sql files in engine/schema/resources/META-INF/db/ do not consider it... ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Adding a SQL table column is not Idempotent > ------------------------------------------- > > Key: CLOUDSTACK-10278 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10278 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Install and Setup > Affects Versions: 4.10.0.0, 4.11.0.0 > Reporter: Ernie Janse van Rensburg > Assignee: Ernie Janse van Rensburg > Priority: Major > Original Estimate: 4h > Remaining Estimate: 4h > > The SQL code to add a new column to a table in the > META-INF/db/schema-41000to41100.sql script is not written in an idempotent > way. When the upgrade is re-run, the code above causes a SQL error as > reported on the user mailing list: > ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) > Error executing: ALTER TABLE cloud.network_offerings ADD COLUMN for_vpc > INT(1) NOT NULL DEFAULT 0 > This is a more generic problem for every version due to to the fact that it > is not idempotent > -- This message was sent by Atlassian JIRA (v7.6.3#76005)