diff --git a/core/src/main/java/com/databasir/core/domain/document/diff/DocumentDiffChecker.java b/core/src/main/java/com/databasir/core/domain/document/diff/DocumentDiffChecker.java index ef68a337..420f616a 100644 --- a/core/src/main/java/com/databasir/core/domain/document/diff/DocumentDiffChecker.java +++ b/core/src/main/java/com/databasir/core/domain/document/diff/DocumentDiffChecker.java @@ -109,10 +109,21 @@ public List diff(List original, List c BaseTypeFieldEqualFunction eq = new BaseTypeFieldEqualFunction(IGNORE_FIELDS); DiffType diffType = eq.apply(currentTable, originalTable) ? DiffType.NONE : DiffType.MODIFIED; + boolean indexModified = indexDiffs.stream() + .anyMatch(indexDiff -> indexDiff.getDiffType() != DiffType.NONE); + boolean triggerModified = triggerDiffs.stream() + .anyMatch(triggerDiff -> triggerDiff.getDiffType() != DiffType.NONE); + boolean fkModified = fkDiffs.stream() + .anyMatch(fkDiff -> fkDiff.getDiffType() != DiffType.NONE); + if (indexModified || triggerModified || fkModified) { + diffType = DiffType.MODIFIED; + } + // workaround for diffType = NONE if (diffType == DiffType.NONE) { originalTable = null; } + return TableDocDiff.builder() .id(currentTable.getId()) .diffType(diffType) diff --git a/meta/src/main/java/com/databasir/core/meta/provider/MetaProviders.java b/meta/src/main/java/com/databasir/core/meta/provider/MetaProviders.java index 12dabf5d..d6948e3b 100644 --- a/meta/src/main/java/com/databasir/core/meta/provider/MetaProviders.java +++ b/meta/src/main/java/com/databasir/core/meta/provider/MetaProviders.java @@ -13,6 +13,7 @@ import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; +import java.util.PriorityQueue; @Slf4j public class MetaProviders { @@ -73,6 +74,7 @@ private static DatabaseMetaProvider mysql() { } private static DatabaseMetaProvider sqlServer() { + SqlServerColumnMetaProvider var = new SqlServerColumnMetaProvider(); var columnMetaProvider = new SqlServerColumnMetaProvider(); var foreignKeyMetaProvider = new JdbcForeignKeyMetaProvider(); var indexMetaProvider = new JdbcIndexMetaProvider(); @@ -87,6 +89,9 @@ private static DatabaseMetaProvider sqlServer() { } private static DatabaseMetaProvider postgresql() { + var queue = new PriorityQueue(); + queue.offer(1); + var columnMetaProvider = new JdbcColumnMetaProvider(); var foreignKeyMetaProvider = new JdbcForeignKeyMetaProvider(); var indexMetaProvider = new JdbcIndexMetaProvider();