migrate_delete
Module provides administration tools to safely delete migration related database tables (migrate_map_* and migrate_message_*). This module is designed for Drupal sites that have completed migrations and no longer need the migration tracking tables. It's particularly useful for cleaning up databases after successful migration projects.
Warning
This action cannot be undone. Once migration tables are deleted, all migration tracking data and error messages will be permanently lost. Only use this module when you are certain you no longer need migration data. Make a database backup before using.
Installation
- Composer require
drupal/migrate_delete - Enable the module through the Drupal admin ui or with Drush:
drush en migrate_delete
Usage
Web UI
- Navigate to Configuration > System > Delete Migration Tables (
/admin/config/system/migrate-delete) - Review the list of migration tables that will be deleted
- Check the confirmation checkbox to acknowledge that this action cannot be undone
- Click "Delete all migration tables" to proceed
Drush Commands
The module provides two Drush cli commands:
List Migration Tables
# List all migration tables drush migrate-delete:list # or use the alias drush mdl
This command will show:
- Count of migration tables found
- Migration map tables (
migrate_map_*) - Migration message tables (
migrate_message_*)
Delete Migration Tables
# Delete all migration tables drush migrate-delete:delete # or use the alias drush mdd # Delete without confirmation (use with caution!) drush migrate-delete:delete -y # or drush mdd -y
The delete command will:
- List all tables that will be deleted
- Show a warning about permanent data loss
- Require confirmation (unless
-yflag is used) - Provide real-time feedback during deletion
- Show a summary of results
Features
- Detailed Listing: Shows all tables that will be deleted, grouped by type
- Safe Table Detection: Only finds and lists actual migration tables matching the expected patterns
- User Confirmation: Requires explicit confirmation before deletion
- Security Validation: Validates table names to prevent unauthorized deletions
- Error Handling: Provides clear feedback on success or failure
- Drush Integration: Full command-line support with list and delete operations
Security Considerations
- Tables are validated against expected naming patterns before deletion
- Provides multiple confirmation steps to prevent accidental deletion
What Gets Deleted
This module will delete:
- All tables starting with
migrate_map_* - All tables starting with
migrate_message_*
These tables contain:
- Migration mapping data between source and destination entities
- Migration error messages and debugging information
Drush Command Examples
List all migration tables:
$ drush migrate-delete:list Found 10 migration tables: Migration Map Tables (5): - migrate_map_d7_block - migrate_map_d7_comment - migrate_map_d7_node_article - migrate_map_d7_taxonomy_term - migrate_map_d7_user Migration Message Tables (5): - migrate_message_d7_block - migrate_message_d7_comment - migrate_message_d7_node_article - migrate_message_d7_taxonomy_term - migrate_message_d7_user Use "drush migrate-delete:delete" to delete these tables.
Delete migration tables:
$ drush migrate-delete:delete Found 10 migration tables that will be deleted: Map tables (5): migrate_map_d7_block, migrate_map_d7_comment, ... Message tables (5): migrate_message_d7_block, migrate_message_d7_comment, ... WARNING: This action cannot be undone! Are you sure you want to delete all these migration tables? (y/N): y Deleting migration tables... ✓ Deleted: migrate_map_d7_block ✓ Deleted: migrate_map_d7_comment ✓ Deleted: migrate_message_d7_block ✓ Deleted: migrate_message_d7_comment ... Successfully deleted 10 migration tables.
Delete migration tables without confirmation:
$ drush migrate-delete:delete -y Found 10 migration tables that will be deleted: Map tables (5): migrate_map_d7_block, migrate_map_d7_comment, ... Message tables (5): migrate_message_d7_block, migrate_message_d7_comment, ... WARNING: This action cannot be undone! Deleting migration tables... ✓ Deleted: migrate_map_d7_block ✓ Deleted: migrate_map_d7_comment ... Successfully deleted 10 migration tables.
Recommended modules/libraries
Drush