feat: add database dump functionality with UI integration #469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ Feature: Easy Database Dump/Export to File
Closes #101
This PR introduces a highly-requested feature that allows users to easily export the entire connected database to a local file directly from the application's sidebar. This provides a simple way for users to back up their database (schema and data) or migrate it externally.
🚀 What's Included
This feature required coordinated changes across the UI, core commands, and the database driver layer:
UI Integration & User Flow:
tools-sidebar.tsx).DumpDatabaseTabwhich presents a clear action button to trigger the export and handles user feedback (loading, success, or failure states).Core Command Registration:
openBuiltinDumpDatabase) to manage the opening of the dedicated dump tab when the sidebar button is clicked.🛠️ Driver Capability & Implementation
This PR establishes the essential driver framework for database exporting, ensuring future compatibility for all drivers.
1. Capability Layer
DriverFlagsExtension: Added an optional boolean flag,supportDumpDatabase, to theDriverFlagsinterface. This allows us to feature-gate the dump functionality based on whether a specific driver supports it.BaseDriverAbstract Method: Added an abstractdumpDatabasemethod to theBaseDriver, standardizing the interface for all driver implementations.2. SQLite Implementation
dumpDatabasemethod specifically forSqliteLikeBaseDriver(covering SQLite and similar engines).INSERTstatements for all tables.🔮 Future-Proofing
The driver-based approach ensures that as we add support for other engines (like PostgreSQL or MySQL), we only need to implement the
dumpDatabasemethod within their respective drivers to enable this feature for those databases as well!📷 Image Reference