Skip to main content
Ungathered Thoughts

Drush SQL Sanitize Config

A handy snippet to sanitize DB snippets:

# drush/drush.yml
# ...
sql:
  structure-tables:
    # Data to exclude from default sync/dump.
    common:
      - cache
      - 'cache_*'
      - history
      - queue
      - 'search_*'
      - 'session'
      - watchdog
      - 'webform_*'
  skip-tables:
    # Whole tables to exclude from default sync/dump.
    common:
      - 'migration_*'
      - 'migrate_*'
command:
  sql:
    dump:
      options:
        structure-tables-key: common
        skip-tables-key: common
    sync:
      options:
        structure-tables-key: common
        skip-tables-key: common

Via @sime on Drupal Slack.