Skip to content

Commit

Permalink
Generated indexes are not including "desc"
Browse files Browse the repository at this point in the history
DAT-3773
  • Loading branch information
nvoxland committed Jan 2, 2020
1 parent 3e79b12 commit edba083
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -351,8 +351,15 @@ protected <T extends DatabaseObject> T include(T example) throws DatabaseExcepti
private void includeNestedObjects(DatabaseObject object) throws DatabaseException, InvalidExampleException, ReflectiveOperationException {
for (String field : new HashSet<>(object.getAttributes())) {
Object fieldValue = object.getAttribute(field, Object.class);
if ("columns".equals(field) && ((object.getClass() == PrimaryKey.class) || (object.getClass() == Index.class) || (object.getClass() == UniqueConstraint.class))) {
continue;
if ("columns".equals(field) && ((object.getClass() == PrimaryKey.class) || (object.getClass() == Index
.class) || (object.getClass() == UniqueConstraint.class))) {
if ((fieldValue != null) && !((Collection) fieldValue).isEmpty()) {
final Column column = (Column) ((Collection) fieldValue).iterator().next();
String columnName = column.getName();
if ((column.getDescending() != null && column.getDescending()) || columnName.endsWith(" ASC") || columnName.endsWith(" DESC") || columnName.endsWith(" RANDOM")) {
continue;
}
}
}
Object newFieldValue = replaceObject(fieldValue);
if (newFieldValue == null) { //sometimes an object references a non-snapshotted object. Leave it with the unsnapshotted example
Expand Down

0 comments on commit edba083

Please sign in to comment.