Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: diff indexes ignoring order (#10495)
Liu Jice8b6e15c991
diff --git a/frontend/src/components/SchemaEditorLite/algorithm/diff-merge.ts b/frontend/src/components/SchemaEditorLite/algorithm/diff-merge.tsindex 61c357e7a0..cf61d88f66 100644--- a/frontend/src/components/SchemaEditorLite/algorithm/diff-merge.ts+++ b/frontend/src/components/SchemaEditorLite/algorithm/diff-merge.ts@@ -11,7 +11,7 @@ import {TableConfig,TableMetadata,} from "@/types/proto/v1/database_service";-import { TinyTimer } from "@/utils";+import { TinyTimer, keyBy } from "@/utils";import {ComparableColumnFields,ComparableForeignKeyFields,@@ -251,9 +251,13 @@ export class DiffMerge {if (sourceIndexes.length !== targetIndexes.length) {return false;}+ const targetIndexesByName = keyBy(targetIndexes, (idx) => idx.name);+for (let i = 0; i < sourceIndexes.length; i++) {const sourceIndex = sourceIndexes[i];- const targetIndex = targetIndexes[i];+ const targetIndex = targetIndexesByName.get(sourceIndex.name);+ // targetIndex not found+ if (!targetIndex) return false;if (!isEqual(pick(sourceIndex, ComparableIndexFields),