mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 17:33:58 +00:00
db diff sort
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { DbDiffOptions, testEqualColumns, testEqualTables, testEqualSqlObjects } from './diffTools';
|
||||
import { DatabaseInfo, EngineDriver, SqlObjectInfo, TableInfo } from 'dbgate-types';
|
||||
import _ from 'lodash';
|
||||
|
||||
export function computeDiffRowsCore(sourceList, targetList, testEqual) {
|
||||
const res = [];
|
||||
@@ -75,7 +76,8 @@ export function computeDbDiffRows(
|
||||
for (const objectTypeField of ['tables', 'views', 'procedures', 'matviews', 'functions']) {
|
||||
const defs = COMPARE_DEFS[objectTypeField];
|
||||
res.push(
|
||||
...computeDiffRowsCore(sourceDb[objectTypeField], targetDb[objectTypeField], (a, b) =>
|
||||
..._.sortBy(
|
||||
computeDiffRowsCore(sourceDb[objectTypeField], targetDb[objectTypeField], (a, b) =>
|
||||
defs.test(a, b, opts, targetDb, driver)
|
||||
).map(row => ({
|
||||
...row,
|
||||
@@ -89,7 +91,9 @@ export function computeDbDiffRows(
|
||||
row?.source?.pureName || row?.target?.pureName
|
||||
}`,
|
||||
objectTypeField,
|
||||
}))
|
||||
})),
|
||||
'identifier'
|
||||
)
|
||||
);
|
||||
}
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user