Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module enhances the database dumping tool by allowing you to export database tables into individual PHP files. It also provides options to split large tables into smaller files to reduce memory usage during export and import, making it easier to manage and maintain database migration fixtures.

Smart DB Tools is a module🤔 which implements the feature requested in #3213633: Improve DX of maintaining migration database fixtures: provide an option for creating per-table database fixtures in DbDumpcommand.

It contains an enhanced version of the DbToolsApplication of Drupal core with an improved dump command that allows users to save a database dump into multiple PHP scripts – so each database table will be exported in its own file.

This functionality greatly reduces the time spent on cleaning changed database fixture scripts.

Usage

The application is backward-compatible with the DbToolsApplication in Drupal core. The only difference is that if the --split-destination option is passed to the script, then instead of a single file, per-table database PHP scripts will be generated. The value of the --split-destination option is the name of the main PHP database dump file.

To lower memory consumption (both on export and import), tables with more than 1000 records are also exported into multiple files (this is by default). This option can be changed by providing a --subsplit-limit option set to the desired value. Using --subsplit-limit 1000 works well with PHP memory_limit set to 256M. Setting this limit to a number lower than 1 disables this behavior.

Example

php modules/contrib/smart_db_tools/scripts/smart-db-tools.php dump\
 --database fixture_connection\
 --subsplit-limit 5000\
 --split-destination modules/custom/db-dump.php

Activity

Total releases
1
First release
Dec 2025
Latest release
7 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Release date
1.1.0 Stable Dec 9, 2025