mirror of
https://github.com/t8y2/dbx.git
synced 2026-11-01 16:28:46 +00:00
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:
@@ -13,6 +13,7 @@ const showTableImportDialog = ref(false);
|
||||
const showStructureEditorDialog = ref(false);
|
||||
const showFieldLineageDialog = ref(false);
|
||||
const showDatabaseSearchDialog = ref(false);
|
||||
const showDatabaseExportDialog = ref(false);
|
||||
const showImportLayoutConfirm = ref(false);
|
||||
const pendingImportLayout = ref<SidebarLayout | null>(null);
|
||||
const showConfigPassphraseDialog = ref(false);
|
||||
@@ -51,6 +52,9 @@ const lineagePrefillColumn = ref("");
|
||||
const databaseSearchPrefillConnectionId = ref("");
|
||||
const databaseSearchPrefillDatabase = ref("");
|
||||
const databaseSearchPrefillSchema = ref("");
|
||||
const databaseExportPrefillConnectionId = ref("");
|
||||
const databaseExportPrefillDatabase = ref("");
|
||||
const databaseExportPrefillSchema = ref("");
|
||||
|
||||
let watchersRegistered = false;
|
||||
|
||||
@@ -183,6 +187,19 @@ export function useDialogSources() {
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
() => connectionStore.databaseExportSource,
|
||||
(v) => {
|
||||
if (v) {
|
||||
databaseExportPrefillConnectionId.value = v.connectionId;
|
||||
databaseExportPrefillDatabase.value = v.database;
|
||||
databaseExportPrefillSchema.value = v.schema ?? "";
|
||||
showDatabaseExportDialog.value = true;
|
||||
connectionStore.databaseExportSource = null;
|
||||
}
|
||||
},
|
||||
);
|
||||
} // end watchersRegistered
|
||||
|
||||
// Config export/import helpers
|
||||
@@ -258,6 +275,7 @@ export function useDialogSources() {
|
||||
showStructureEditorDialog,
|
||||
showFieldLineageDialog,
|
||||
showDatabaseSearchDialog,
|
||||
showDatabaseExportDialog,
|
||||
showImportLayoutConfirm,
|
||||
pendingImportLayout,
|
||||
showConfigPassphraseDialog,
|
||||
@@ -295,6 +313,9 @@ export function useDialogSources() {
|
||||
databaseSearchPrefillConnectionId,
|
||||
databaseSearchPrefillDatabase,
|
||||
databaseSearchPrefillSchema,
|
||||
databaseExportPrefillConnectionId,
|
||||
databaseExportPrefillDatabase,
|
||||
databaseExportPrefillSchema,
|
||||
onExportClick,
|
||||
onExportConfirm,
|
||||
onImportClick,
|
||||
|
||||
Reference in New Issue
Block a user