engine/schema: fix upgrade path to work with MySQL 5.7

Found this issue when using MySQL 5.7 with Ubuntu 16.04 with following settings:

sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_ENGINE_SUBSTITUTION"
server-id   = 1
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2016-04-25 14:47:22 +05:30
parent d518b619dd
commit c63ea0a240
1 changed files with 1 additions and 1 deletions

View File

@ -1297,7 +1297,7 @@ public class Upgrade410to420 implements DbUpgrade {
s_logger.debug("Index already exists on host_details - not adding new one");
} else {
// add the index
try(PreparedStatement pstmtUpdate = conn.prepareStatement("ALTER IGNORE TABLE `cloud`.`host_details` ADD INDEX `fk_host_details__host_id` (`host_id`)");) {
try(PreparedStatement pstmtUpdate = conn.prepareStatement("ALTER TABLE `cloud`.`host_details` ADD INDEX `fk_host_details__host_id` (`host_id`)");) {
pstmtUpdate.executeUpdate();
s_logger.debug("Index did not exist on host_details - added new one");
}catch (SQLException e) {