fix(data-transfer): handle missing owner role policy and align web sync behavior

* Feat: Add PostgreSQL transfer ownership preview and resolution

- Add ownership policy support for data transfers: preserve, skip, and reassign missing owners
- Preview missing PostgreSQL roles before creating target schema objects
- Show ownership confirmation dialog when target roles are missing
- Allow users to skip ownership changes or reassign missing owners to the target connection user
- Add Tauri and HTTP API support for ownership preview
- Apply ownership statements according to selected policy during PostgreSQL transfers
- Add Chinese localization for ownership confirmation UI

* Feat: Add ownership confirmation localization

- Add ownership confirmation messages for supported desktop locales
- Include skip and confirm labels for ownership handling
- Update transfer test requests to use Preserve ownership policy
This commit is contained in:
Moe. authored and GitHub committed 2026-07-09 00:35:34 +08:00
1 parent 135d4e15db
commit a07f115407
18 files changed
+508 -33

No files matched your search

+3
View File
@@ -278,6 +278,7 @@ export const nacosRawRequest = forward("nacosRawRequest");
// Data Transfer
export const startTransfer = forward("startTransfer");
export const cancelTransfer = forward("cancelTransfer");
export const previewTransferOwnership = forward("previewTransferOwnership");
export const sortTablesByFkDependency = forward("sortTablesByFkDependency");
// Table File Import
@@ -511,6 +512,8 @@ export type {
TransferProgress,
TransferMode,
TransferTableNameCase,
TransferOwnershipPolicy,
TransferOwnershipPreview,
TableImportMode,
TableImportStatus,
TableImportSourceFormat,
+5
View File
@@ -75,6 +75,7 @@ import type {
SqlFileProgress,
TransferRequest,
TransferProgress,
TransferOwnershipPreview,
TableImportPreviewRequest,
TableImportPreview,
TableImportRequest,
@@ -1319,6 +1320,10 @@ export async function cancelTransfer(transferId: string): Promise<void> {
return post("/api/transfer/cancel", { transferId });
}
export async function previewTransferOwnership(request: TransferRequest): Promise<TransferOwnershipPreview> {
return post("/api/transfer/ownership-preview", { request });
}
export interface SortTablesByFkOptions {
connectionId: string;
database: string;
+11
View File
@@ -1889,6 +1889,7 @@ export async function listenSqlFileProgress(handler: (progress: SqlFileProgress)
// --- Data Transfer ---
export type TransferMode = "append" | "overwrite" | "upsert";
export type TransferTableNameCase = "preserve" | "lower" | "upper";
export type TransferOwnershipPolicy = "preserve" | "skip" | "reassignMissing";
export interface TransferRequest {
transferId: string;
@@ -1902,9 +1903,15 @@ export interface TransferRequest {
createTable: boolean;
mode: TransferMode;
targetTableNameCase: TransferTableNameCase;
ownershipPolicy?: TransferOwnershipPolicy;
batchSize: number;
}
export interface TransferOwnershipPreview {
missingOwners: string[];
targetOwner: string;
}
export interface TransferProgress {
transferId: string;
table: string;
@@ -1943,6 +1950,10 @@ export async function cancelTransfer(transferId: string): Promise<void> {
return invoke("cancel_transfer", { transferId });
}
export async function previewTransferOwnership(request: TransferRequest): Promise<TransferOwnershipPreview> {
return invoke("preview_transfer_ownership", { request });
}
export interface SortTablesByFkOptions {
connectionId: string;
database: string;