Skip to content

Commit

Permalink
0005731: Functional indexes are only supported by Oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Marzullo committed Mar 8, 2023
1 parent ce67e4b commit 0248d07
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Expand Up @@ -998,7 +998,31 @@ public void makePlatformSpecific(Database database) {
column.addPlatformColumn(platformColumn);
}
}
if (!getDatabaseInfo().isFunctionalIndicesSupported()) {
List<IIndex> indicesToRemove = new ArrayList<IIndex>();
for (IIndex index : table.getIndices()) {
if (isFunctionalIndex(index)) {
indicesToRemove.add(index);
}
}
for (IIndex indexToRemove : indicesToRemove) {
log.info("Removing index " + indexToRemove.getName()
+ " from table " + table.getName() + " because functional indexes are not supported on this platform.");
table.removeIndex(indexToRemove);
}
}
}
}

private boolean isFunctionalIndex(IIndex index) {
boolean ret = false;
for (IndexColumn indexColumn : index.getColumns()) {
if (indexColumn.getName().contains("(") || indexColumn.getName().contains(")")) {
ret = true;
break;
}
}
return ret;
}

@Override
Expand Down
Expand Up @@ -94,6 +94,8 @@ public class DatabaseInfo {
private boolean generatedColumnsSupported = false;
/** Whether expressions can be used as default values */
private boolean expressionsAsDefaultValuesSupported = false;
/** Whether functional indices are supported */
private boolean functionalIndicesSupported = false;
/**
* Whether the auto-increment definition is done via the DEFAULT part of the column definition.
*/
Expand Down Expand Up @@ -1333,4 +1335,12 @@ public boolean isTriggersContainJava() {
public void setTriggersContainJava(boolean triggersContainJava) {
this.triggersContainJava = triggersContainJava;
}

public boolean isFunctionalIndicesSupported() {
return functionalIndicesSupported;
}

public void setFunctionalIndicesSupported(boolean functionalIndicesSupported) {
this.functionalIndicesSupported = functionalIndicesSupported;
}
}
Expand Up @@ -137,6 +137,7 @@ public OracleDdlBuilder() {
databaseInfo.setTriggersCreateOrReplaceSupported(true);
databaseInfo.setBinaryQuoteStart("0x");
databaseInfo.setBinaryQuoteEnd("");
databaseInfo.setFunctionalIndicesSupported(true);
}

@Override
Expand Down

0 comments on commit 0248d07

Please sign in to comment.