fix: trigger diff failed
This commit is contained in:
parent
ae8dc7ebcc
commit
2a7de68680
|
@ -2,10 +2,7 @@ package com.databasir.core.domain.document.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.document.data.TableDocumentResponse;
|
import com.databasir.core.domain.document.data.TableDocumentResponse;
|
||||||
import com.databasir.core.infrastructure.converter.JsonConverter;
|
import com.databasir.core.infrastructure.converter.JsonConverter;
|
||||||
import com.databasir.core.meta.data.ColumnMeta;
|
import com.databasir.core.meta.data.*;
|
||||||
import com.databasir.core.meta.data.DatabaseMeta;
|
|
||||||
import com.databasir.core.meta.data.IndexMeta;
|
|
||||||
import com.databasir.core.meta.data.TableMeta;
|
|
||||||
import com.databasir.dao.tables.pojos.*;
|
import com.databasir.dao.tables.pojos.*;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
@ -65,6 +62,9 @@ public interface DatabaseMetaConverter {
|
||||||
@Mapping(target = "columnNames", source = "pojo.columnNameArray")
|
@Mapping(target = "columnNames", source = "pojo.columnNameArray")
|
||||||
IndexMeta of(TableIndexDocumentPojo pojo);
|
IndexMeta of(TableIndexDocumentPojo pojo);
|
||||||
|
|
||||||
|
@Mapping(target = "createAt", source = "pojo.triggerCreateAt")
|
||||||
|
TriggerMeta of(TableTriggerDocumentPojo pojo);
|
||||||
|
|
||||||
List<TableMeta> of(List<TableDocumentResponse> table);
|
List<TableMeta> of(List<TableDocumentResponse> table);
|
||||||
|
|
||||||
TableMeta of(TableDocumentResponse table);
|
TableMeta of(TableDocumentResponse table);
|
||||||
|
|
|
@ -35,14 +35,17 @@ public class JdbcIndexMetaProvider implements IndexMetaProvider {
|
||||||
return indexMetas;
|
return indexMetas;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, IndexMeta> pojoGroupByName = new HashMap<>();
|
Map<String, IndexMeta> metaGroupByName = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
while (indexResults.next()) {
|
while (indexResults.next()) {
|
||||||
Boolean nonUnique = indexResults.getBoolean("NON_UNIQUE");
|
Boolean nonUnique = indexResults.getBoolean("NON_UNIQUE");
|
||||||
String indexName = indexResults.getString("INDEX_NAME");
|
String indexName = indexResults.getString("INDEX_NAME");
|
||||||
String columnName = indexResults.getString("COLUMN_NAME");
|
String columnName = indexResults.getString("COLUMN_NAME");
|
||||||
if (pojoGroupByName.containsKey(indexName)) {
|
if (indexName == null) {
|
||||||
pojoGroupByName.get(indexName).getColumnNames().add(columnName);
|
continue;
|
||||||
|
}
|
||||||
|
if (metaGroupByName.containsKey(indexName)) {
|
||||||
|
metaGroupByName.get(indexName).getColumnNames().add(columnName);
|
||||||
} else {
|
} else {
|
||||||
List<String> columns = new ArrayList<>();
|
List<String> columns = new ArrayList<>();
|
||||||
columns.add(columnName);
|
columns.add(columnName);
|
||||||
|
@ -51,13 +54,13 @@ public class JdbcIndexMetaProvider implements IndexMetaProvider {
|
||||||
.columnNames(columns)
|
.columnNames(columns)
|
||||||
.isUniqueKey(Objects.equals(nonUnique, false))
|
.isUniqueKey(Objects.equals(nonUnique, false))
|
||||||
.build();
|
.build();
|
||||||
pojoGroupByName.put(indexName, indexMeta);
|
metaGroupByName.put(indexName, indexMeta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
indexResults.close();
|
indexResults.close();
|
||||||
}
|
}
|
||||||
return new ArrayList<>(pojoGroupByName.values());
|
return new ArrayList<>(metaGroupByName.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue