Skip to content

Commit 63d054f

Browse files
Restore included column for index name consistency
1 parent e48dbbb commit 63d054f

2 files changed

Lines changed: 14 additions & 69 deletions

File tree

LDK/tools/naturalize/naturalize.cs

Lines changed: 0 additions & 68 deletions
This file was deleted.

laboratory/src/org/labkey/laboratory/LaboratoryManager.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,20 @@ private void processIndexes(DbSchema schema, TableInfo realTable, List<List<Stri
561561
boolean missingCols = false;
562562

563563
List<String> cols = new ArrayList<>();
564+
String[] includedCols = null;
564565

565566
for (String name : indexCols)
566567
{
567568
String[] tokens = name.split(":");
568-
if (!tokens[0].equalsIgnoreCase("include"))
569+
if (tokens[0].equalsIgnoreCase("include"))
570+
{
571+
if (tokens.length > 1)
572+
includedCols = tokens[1].split(",");
573+
}
574+
else
575+
{
569576
cols.add(tokens[0]);
577+
}
570578
}
571579

572580
for (String col : cols)
@@ -583,6 +591,11 @@ private void processIndexes(DbSchema schema, TableInfo realTable, List<List<Stri
583591

584592
String idxPrefix = "LABORATORY_IDX_";
585593
String indexName = idxPrefix + realTable.getName() + "_" + StringUtils.join(cols, "_");
594+
// The index itself no longer covers the included columns, but the suffix stays in the name so existing indexes are still recognized
595+
if (includedCols != null)
596+
{
597+
indexName += "_include_" + StringUtils.join(includedCols, "_");
598+
}
586599

587600
if (distinctIndexes.contains(indexName))
588601
throw new RuntimeException("An index has already been created with the name: " + indexName);

0 commit comments

Comments
 (0)