diff --git a/apps/desktop/src/components/transfer/DataTransferDialog.vue b/apps/desktop/src/components/transfer/DataTransferDialog.vue index 0900b40ae1..c0c61a6cbc 100644 --- a/apps/desktop/src/components/transfer/DataTransferDialog.vue +++ b/apps/desktop/src/components/transfer/DataTransferDialog.vue @@ -1048,7 +1048,7 @@ const confirmationSummary = computed(() => { if (!request) return ""; const source = `${getConnectionName(request.sourceConnectionId)}.${request.sourceDatabase}.${request.sourceSchema}`; const target = `${getConnectionName(request.targetConnectionId)}.${request.targetDatabase}.${request.targetSchema}`; - const count = request.objects.reduce((total, selection) => total + selection.names.length, 0); + const count = request.tables.length + request.objects.reduce((total, selection) => total + selection.names.length, 0); return t("transfer.startConfirmMessage", { source, target, count }); }); @@ -1056,7 +1056,8 @@ const confirmationStrategy = computed(() => (confirmationRequest.value ? transfe const rebuildConfirmationDetails = computed(() => { const rebuild = confirmationPreview.value?.rebuild; if (!rebuild) return ""; - return [confirmationSummary.value, t("transfer.rebuildSummary", { count: rebuild.tables.length }), ...rebuild.warnings].filter(Boolean).join("\n"); + const missingTargets = rebuild.tables.some((table) => !table.backupTable); + return [confirmationSummary.value, t("transfer.rebuildSummary", { count: rebuild.tables.length }), missingTargets ? t("transfer.rebuildMissingTargets") : ""].filter(Boolean).join("\n"); }); function requestTransferConfirmation(request: api.TransferRequest, preview: api.TransferOwnershipPreview): Promise { diff --git a/apps/desktop/src/components/transfer/__tests__/transferStrategy.spec.ts b/apps/desktop/src/components/transfer/__tests__/transferStrategy.spec.ts index cc627fb934..742d3c5183 100644 --- a/apps/desktop/src/components/transfer/__tests__/transferStrategy.spec.ts +++ b/apps/desktop/src/components/transfer/__tests__/transferStrategy.spec.ts @@ -46,7 +46,6 @@ function preview(overrides: Partial = {}): TransferOwn rebuild: { sql: 'ALTER TABLE "reporting"."orders" RENAME TO "orders__dbx_bak_123";\nCREATE TABLE "reporting"."orders" ("id" INTEGER);', tables: [{ sourceTable: "Orders", targetTable: '"reporting"."orders"', backupTable: '"reporting"."orders__dbx_bak_123"' }], - warnings: ["Target-only metadata will be replaced"], }, ...overrides, }; diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts index fcb3c2b4dc..a3933ab4dc 100644 --- a/apps/desktop/src/i18n/locales/en.ts +++ b/apps/desktop/src/i18n/locales/en.ts @@ -5615,6 +5615,7 @@ export default { rebuildDataOnlyDisabled: "Rebuild is unavailable for data-only transfers. Select structure and data or structure only.", rebuildUnsupportedDisabled: "The selected target engine does not support rebuilding target tables.", rebuildPreviewUnavailable: "The backend did not provide a rebuild plan. The transfer has not started; refresh the preview with a backend that supports rebuild.", + rebuildMissingTargets: "Some target tables do not exist yet and will be created without a backup.", previewFailed: "Could not prepare the transfer: {message}", start: "Start Transfer", startConfirmTitle: "Confirm transfer", diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts index 5f3b7aa99d..7ac50a3ebe 100644 --- a/apps/desktop/src/i18n/locales/es.ts +++ b/apps/desktop/src/i18n/locales/es.ts @@ -5252,6 +5252,7 @@ export default withEnglishFallback({ rebuildDataOnlyDisabled: "La reconstrucción no está disponible para transferencias de solo datos. Seleccione estructura y datos o solo estructura.", rebuildUnsupportedDisabled: "El motor de destino seleccionado no permite reconstruir las tablas de destino.", rebuildPreviewUnavailable: "El backend no devolvió un plan de reconstrucción. La transferencia no se ha iniciado; vuelva a obtener la vista previa con un backend compatible.", + rebuildMissingTargets: "Algunas tablas de destino aún no existen y se crearán sin copia de seguridad.", previewFailed: "No se pudo preparar la transferencia: {message}", start: "Iniciar transferencia", startConfirmTitle: "Confirmar transferencia", diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts index d142ecc886..7a465c54ee 100644 --- a/apps/desktop/src/i18n/locales/it.ts +++ b/apps/desktop/src/i18n/locales/it.ts @@ -5253,6 +5253,7 @@ export default withEnglishFallback({ rebuildDataOnlyDisabled: "La ricostruzione non è disponibile per i trasferimenti di soli dati. Selezionare struttura e dati oppure solo struttura.", rebuildUnsupportedDisabled: "Il motore di destinazione selezionato non supporta la ricostruzione delle tabelle di destinazione.", rebuildPreviewUnavailable: "Il backend non ha restituito un piano di ricostruzione. Il trasferimento non è iniziato; aggiornare l’anteprima con un backend compatibile.", + rebuildMissingTargets: "Alcune tabelle di destinazione non esistono ancora e verranno create senza backup.", previewFailed: "Impossibile preparare il trasferimento: {message}", start: "Avvia Trasferimento", startConfirmTitle: "Conferma trasferimento", diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts index d79789754b..04ae0feaeb 100644 --- a/apps/desktop/src/i18n/locales/ja.ts +++ b/apps/desktop/src/i18n/locales/ja.ts @@ -5282,6 +5282,7 @@ export default withEnglishFallback({ rebuildDataOnlyDisabled: "データのみの転送では再構築できません。「構造とデータ」または「構造のみ」を選択してください。", rebuildUnsupportedDisabled: "選択したターゲットエンジンはテーブルの再構築をサポートしていません。", rebuildPreviewUnavailable: "バックエンドから再構築計画が返されなかったため、転送は開始されていません。再構築プレビューに対応したバックエンドで再試行してください。", + rebuildMissingTargets: "存在しないターゲットテーブルがあります。バックアップなしで直接作成されます。", previewFailed: "転送を準備できませんでした:{message}", start: "転送開始", startConfirmTitle: "転送の開始確認", diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts index 7940bc5cfc..b156978122 100644 --- a/apps/desktop/src/i18n/locales/ko.ts +++ b/apps/desktop/src/i18n/locales/ko.ts @@ -4947,6 +4947,7 @@ export default withEnglishFallback({ rebuildDataOnlyDisabled: "데이터만 전송할 때는 재구축할 수 없습니다. 구조 및 데이터 또는 구조만을 선택하세요.", rebuildUnsupportedDisabled: "선택한 대상 엔진은 대상 테이블 재구축을 지원하지 않습니다.", rebuildPreviewUnavailable: "백엔드가 재구축 계획을 반환하지 않아 전송을 시작하지 않았습니다. 재구축 미리 보기를 지원하는 백엔드에서 다시 시도하세요.", + rebuildMissingTargets: "존재하지 않는 대상 테이블이 있습니다. 백업 없이 바로 생성됩니다.", previewFailed: "전송을 준비할 수 없습니다: {message}", start: "이전 시작", startConfirmTitle: "전송 시작 확인", diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts index c916c40140..21a8de1123 100644 --- a/apps/desktop/src/i18n/locales/pt-BR.ts +++ b/apps/desktop/src/i18n/locales/pt-BR.ts @@ -5255,6 +5255,7 @@ export default withEnglishFallback({ rebuildDataOnlyDisabled: "A reconstrução não está disponível para transferências apenas de dados. Selecione estrutura e dados ou apenas estrutura.", rebuildUnsupportedDisabled: "O mecanismo de destino selecionado não oferece suporte à reconstrução das tabelas de destino.", rebuildPreviewUnavailable: "O backend não retornou um plano de reconstrução. A transferência não foi iniciada; atualize a prévia com um backend compatível.", + rebuildMissingTargets: "Algumas tabelas de destino ainda não existem e serão criadas sem backup.", previewFailed: "Não foi possível preparar a transferência: {message}", start: "Iniciar transferência", startConfirmTitle: "Confirmar transferência", diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts index ed43acde78..6c7dc7149b 100644 --- a/apps/desktop/src/i18n/locales/zh-CN.ts +++ b/apps/desktop/src/i18n/locales/zh-CN.ts @@ -5599,6 +5599,7 @@ export default withEnglishFallback({ rebuildDataOnlyDisabled: "仅数据模式不支持重建,请选择“结构和数据”或“仅结构”。", rebuildUnsupportedDisabled: "当前目标引擎不支持重建目标表。", rebuildPreviewUnavailable: "后端未返回重建计划,传输尚未开始。请使用支持重建预览的后端后重新预览。", + rebuildMissingTargets: "部分目标表尚不存在,将直接创建(无备份)。", previewFailed: "无法准备传输:{message}", start: "开始传输", startConfirmTitle: "确认开始传输", diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts index b9aefeeb13..a7cc691720 100644 --- a/apps/desktop/src/i18n/locales/zh-TW.ts +++ b/apps/desktop/src/i18n/locales/zh-TW.ts @@ -4570,6 +4570,7 @@ export default withEnglishFallback({ rebuildDataOnlyDisabled: "僅資料模式不支援重建,請選擇「結構和資料」或「僅結構」。", rebuildUnsupportedDisabled: "目前目標引擎不支援重建目標表。", rebuildPreviewUnavailable: "後端未傳回重建計畫,傳輸尚未開始。請使用支援重建預覽的後端後重新預覽。", + rebuildMissingTargets: "部分目標資料表尚不存在,將直接建立(無備份)。", previewFailed: "無法準備傳輸:{message}", start: "開始傳輸", startConfirmTitle: "確認開始傳輸", diff --git a/apps/desktop/src/lib/backend/tauri.ts b/apps/desktop/src/lib/backend/tauri.ts index 6befc06267..d207697b24 100644 --- a/apps/desktop/src/lib/backend/tauri.ts +++ b/apps/desktop/src/lib/backend/tauri.ts @@ -4644,7 +4644,6 @@ export interface TransferOwnershipPreview { rebuild?: { sql: string; tables: Array<{ sourceTable: string; targetTable: string; backupTable?: string }>; - warnings: string[]; }; } diff --git a/crates/dbx-core/src/transfer.rs b/crates/dbx-core/src/transfer.rs index 1ecb07ec6a..302813c89c 100644 --- a/crates/dbx-core/src/transfer.rs +++ b/crates/dbx-core/src/transfer.rs @@ -239,7 +239,6 @@ pub struct TransferOwnershipPreview { pub struct TransferRebuildPreview { pub sql: String, pub tables: Vec, - pub warnings: Vec, } #[derive(Debug, Clone, Serialize)] @@ -6931,13 +6930,7 @@ async fn build_rebuild_preview( phases.push(format!("-- 3. Drop backups after success\n{}", drop_statements.join(";\n"))); } - let warnings = if resolved.iter().any(|(_, _, preexisting)| !preexisting) { - vec!["Some target tables do not exist yet and will be created without a backup.".to_string()] - } else { - Vec::new() - }; - - Ok(TransferRebuildPreview { sql: phases.join("\n\n"), tables, warnings }) + Ok(TransferRebuildPreview { sql: phases.join("\n\n"), tables }) } pub async fn preview_transfer_ownership(