postgre incremental analysis, fixed mysql incremental analysis

This commit is contained in:
Jan Prochazka
2020-09-28 11:33:25 +02:00
parent fbd963bfb1
commit a88e38dcf7
14 changed files with 194 additions and 53 deletions

View File

@@ -46,7 +46,7 @@ class DatabaseAnalyser {
return this._runAnalysis();
}
mergeAnalyseResult(newlyAnalysed) {
mergeAnalyseResult(newlyAnalysed, extractObjectId) {
if (this.structure == null) {
return {
...DatabaseAnalyser.createEmptyStructure(),
@@ -58,12 +58,12 @@ class DatabaseAnalyser {
for (const field of ['tables', 'views', 'functions', 'procedures', 'triggers']) {
const removedIds = this.modifications
.filter((x) => x.action == 'remove' && x.objectTypeField == field)
.map((x) => x.objectId);
.map((x) => extractObjectId(x));
const newArray = newlyAnalysed[field] || [];
const addedChangedIds = newArray.map((x) => x.objectId);
const addedChangedIds = newArray.map((x) => extractObjectId(x));
const removeAllIds = [...removedIds, ...addedChangedIds];
res[field] = _.sortBy(
[...this.structure[field].filter((x) => !removeAllIds.includes(x.objectId)), ...newArray],
[...this.structure[field].filter((x) => !removeAllIds.includes(extractObjectId(x))), ...newArray],
(x) => x.pureName
);
}