mirror of
https://github.com/vran-dev/databasir.git
synced 2025-09-17 00:57:11 +08:00
fix: trigger diff failed
This commit is contained in:
@@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user