feat: export entire database as SQL file

Add a new "Export Database" feature accessible from the sidebar
right-click menu on database/schema nodes. Generates a .sql file
containing CREATE TABLE DDL, batched INSERT statements, and
view/procedure/function source code.

Backend (database_export.rs):
- Stream-writes SQL to file with configurable batch size
- Supports all SQL database types via existing DDL/INSERT generators
- Progress events with cancellation support
- Graceful error handling (continues on per-table failures)

Frontend (DatabaseExportDialog.vue):
- Connection/database/schema selector
- Checkboxes: structure, data, objects
- Real-time progress with current table and row count
- Cancel button

Wired up through Tauri commands, Web SSE routes, and API layer.
This commit is contained in:
t8y2
2026-05-13 01:08:16 +08:00
parent 83216b2765
commit 9ba2976d11
14 changed files with 1134 additions and 139 deletions
+6
View File
@@ -91,6 +91,11 @@ export const useConnectionStore = defineStore("connection", () => {
database: string;
schema?: string;
} | null>(null);
const databaseExportSource = ref<{
connectionId: string;
database: string;
schema?: string;
} | null>(null);
const sidebarLayout = ref<SidebarLayout>(emptyLayout());
let layoutPersistTimer: ReturnType<typeof setTimeout> | null = null;
@@ -1400,6 +1405,7 @@ export const useConnectionStore = defineStore("connection", () => {
structureEditorSource,
fieldLineageSource,
databaseSearchSource,
databaseExportSource,
createConnectionGroup(name: string) {
const result = createGroupOp(sidebarLayout.value, name);
updateLayoutAndRebuild(result.layout);