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