From 26bfc6d00602e7b3a5055fd3fd0e1858a148ea99 Mon Sep 17 00:00:00 2001 From: Joy A Date: Fri, 15 Nov 2024 12:09:10 +0530 Subject: [PATCH] avniproject/avni-media#179 | Fix duplicate index creation on media table --- .../etl/repository/rowMappers/MediaTableMetadataBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/avniproject/etl/repository/rowMappers/MediaTableMetadataBuilder.java b/src/main/java/org/avniproject/etl/repository/rowMappers/MediaTableMetadataBuilder.java index d516bcf..e7f6388 100644 --- a/src/main/java/org/avniproject/etl/repository/rowMappers/MediaTableMetadataBuilder.java +++ b/src/main/java/org/avniproject/etl/repository/rowMappers/MediaTableMetadataBuilder.java @@ -1,5 +1,6 @@ package org.avniproject.etl.repository.rowMappers; +import org.avniproject.etl.domain.metadata.Column; import org.avniproject.etl.domain.metadata.ColumnMetadata; import org.avniproject.etl.domain.metadata.IndexMetadata; import org.avniproject.etl.domain.metadata.TableMetadata; @@ -15,7 +16,7 @@ public static TableMetadata build() { mediaTableMetadata.setName(mediaTable.name(null)); mediaTableMetadata.setType(TableMetadata.Type.Media); mediaTableMetadata.addColumnMetadata(mediaTable.columns().stream().map(column -> new ColumnMetadata(column, null, null, null)).collect(Collectors.toList())); - mediaTableMetadata.addIndexMetadata(mediaTable.columns().stream().map(column -> column.isIndexed() ? new IndexMetadata(new ColumnMetadata(column)) : null).filter(Objects::nonNull).collect(Collectors.toList())); + mediaTable.columns().stream().filter(Column::isIndexed).forEach(column -> mediaTableMetadata.addIndexMetadata(column)); return mediaTableMetadata; } }