public String getCreateIndexSql(String indexName, Table.IndexType indexType, Table table, List<Column> columns,
Model model) {
List<String> qcols = new ArrayList<>(columns.size());
List<String> pcols = new ArrayList<>(columns.size());
for (Column col : columns) {
qcols.add(col.getQuotedName());
pcols.add(col.getPhysicalName());
}
String quotedIndexName = openQuote() + getIndexName(table.getKey(), pcols) + closeQuote();
if (indexType == Table.IndexType.FULLTEXT) {
return getCreateFulltextIndexSql(indexName, quotedIndexName, table, columns, model);
} else {
String unique = indexType == Table.IndexType.UNIQUE ? "UNIQUE " : "";
return String.format("CREATE %sINDEX %s ON %s (%s)", unique, quotedIndexName, table.getQuotedName(),
String.join(", ", qcols));
}
}