weizhouapache commented on code in PR #8276:
URL: https://github.com/apache/cloudstack/pull/8276#discussion_r1415266596


##########
engine/schema/src/main/java/com/cloud/upgrade/dao/DatabaseAccessObject.java:
##########
@@ -101,8 +105,14 @@ public boolean indexExists(Connection conn, String 
tableName, String indexName)
         return false;
     }
 
-    public void createIndex(Connection conn, String tableName, String 
columnName, String indexName) {
-        String stmt = String.format("CREATE INDEX %s on %s (%s)", indexName, 
tableName, columnName);
+    public void createIndex(Connection conn, String tableName, String 
indexName, String... columnNames) {
+        StringBuilder stmtBuilder = new StringBuilder("CREATE INDEX " + 
indexName + " ON " + tableName + " (");
+        for (String column : columnNames) {
+            stmtBuilder.append(column).append(",");
+        }
+        stmtBuilder.deleteCharAt(stmtBuilder.length() - 1);

Review Comment:
   ```suggestion
           stmtBuilder.append(StringUtils.join(columnNames, ","));
   ```
   
   need to `import org.apache.commons.lang3.StringUtils;`
   not tested it 



-- 
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]

Reply via email to