harikrishna-patnala commented on code in PR #9340: URL: https://github.com/apache/cloudstack/pull/9340#discussion_r1686392058
########## engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41910to42000.java: ########## @@ -80,4 +85,32 @@ public void updateSystemVmTemplates(Connection conn) { throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); } } + + private void checkAndUpdateAffinityGroupNameCharSetToUtf8mb4(Connection conn) { + logger.debug("Check and update char set for affinity group name to utf8mb4"); + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT MAX(LENGTH(name)) FROM `cloud`.`affinity_group`"); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) { + long maxLengthOfName = rs.getLong(1); + if (maxLengthOfName <= MAX_INDEXED_CHARS_IN_CHAR_SET_UTF8MB4) { + pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`affinity_group` MODIFY `name` VARCHAR(191) CHARACTER SET utf8mb4 NOT NULL"); Review Comment: @sureshanaparti please use the string constant for 191 in the prepareStatement, later someone may miss changing here. -- 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: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org