Skip to content

Conversation

@Victor1890
Copy link

✨ 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:

    • A new "Dump Database to File" button is added to the Tools Sidebar (tools-sidebar.tsx).
    • Clicking this button opens a new, dedicated DumpDatabaseTab which presents a clear action button to trigger the export and handles user feedback (loading, success, or failure states).
    • (See diffs: [1], [2])
  • Core Command Registration:

    • Registered a new core command and tab extension (openBuiltinDumpDatabase) to manage the opening of the dedicated dump tab when the sidebar button is clicked.
    • (See diffs: [1], [2])

🛠️ Driver Capability & Implementation

This PR establishes the essential driver framework for database exporting, ensuring future compatibility for all drivers.

1. Capability Layer

  • DriverFlags Extension: Added an optional boolean flag, supportDumpDatabase, to the DriverFlags interface. This allows us to feature-gate the dump functionality based on whether a specific driver supports it.
  • BaseDriver Abstract Method: Added an abstract dumpDatabase method to the BaseDriver, standardizing the interface for all driver implementations.

2. SQLite Implementation

  • Implemented the dumpDatabase method specifically for SqliteLikeBaseDriver (covering SQLite and similar engines).
  • This implementation generates a complete, runnable SQL dump file containing:
    • Schema definitions (for tables, views, and triggers).
    • Data INSERT statements for all tables.
    • (See diffs: [1], [2])

🔮 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 dumpDatabase method within their respective drivers to enable this feature for those databases as well!


📷 Image Reference

image

@Victor1890 Victor1890 marked this pull request as ready for review December 2, 2025 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Dump database to db file

1 participant