fix(transfer): stop duplicating the database name in start confirm

This commit is contained in:
onenewcode authored and GitHub committed 2026-09-22 14:20:33 +08:00
1 parent 70c6ce4c28
commit 48f89a2a1a
3 files changed
+30 -4

No files matched your search

@@ -31,3 +31,17 @@ export function normalizeTransferCatalog(catalog: string, catalogs: readonly Cat
export function isSameTransferDatabase(source: TransferDatabaseSelection, target: TransferDatabaseSelection): boolean {
return source.connectionId === target.connectionId && source.database === target.database && normalizeTransferCatalog(source.catalog, source.catalogs) === normalizeTransferCatalog(target.catalog, target.catalogs);
}
/** Confirmation label: skip schema when it equals the database name (MySQL). */
export function formatTransferEndpointLabel(connectionName: string, database: string, schema: string, catalog?: string): string {
const parts: string[] = [];
const name = connectionName.trim();
if (name) parts.push(name);
const catalogName = catalog?.trim() ?? "";
if (catalogName) parts.push(catalogName);
const databaseName = database.trim();
if (databaseName) parts.push(databaseName);
const schemaName = schema.trim();
if (schemaName && schemaName !== databaseName) parts.push(schemaName);
return parts.join(".");
}