Drush sql-dump and sql-sync - skip specific tables
At KnackForge we use Drush more often as a part of Drupal development projects. As Drupal developers, we frequently feel the need for getting the most recent database dump from live site. When I did this recently, it was relatively a big site, thought it would be nice to skip a few tables that are not essential. At least to avoid unnecessary time spent on I/O operations. This is one of the few things that I have least tried with Drush.
Quick Google Search led me to Drush project issue in drupal.org, mostly outdated posts. Had to connect the dots found here and there to get eventually what I needed, hence writing this blog post.
To skip specific tables when using drush sql-dump and sql-sync, in drushrc.php need to have the below code in place,
Once done, for all sql-dump and sql-sync commands you would issue, the above tables will be skipped.
- Beware if any of the above table is not found in your Drupal database the command will fail to complete successfully
- To have skip list per site, you can place drushrc.php in sites/default/ folder.
Hope this will help.