2

As I wrote in my previous question, I am using the following drush commands to synchronize development and staging environments.

drush rsync @dev @staging 
drush sql-sync @dev @staging

How to set up drush sql-sync not to clone users between @dev and @staging environments? I would like to have separate users (and passwords) on @dev and on @staging sites.

1 Answer 1

3

The drush sql-sync has an option --skip-tables-key that allows you drushrc.php to skip tables during the synchronization.

In your drushrc.php you add this line.

$options['skip-tables']['staging'] = array('users', 'users_roles', 'roles', 'permission');

Your drush command line should look like the following.

drush sql-sync --skip-tables-key=staging @dev @staging

You've to be careful, as you've to skip all tables that had informations related to your users, including the tables used from third modules.

4
  • Thank you ! I did the way you suggested. I had some warning messages however I will try to find out maybe on drupal.org drush issue list: include(/sites/all/modules/domain/settings.inc): failed to open stream: No such file or directory in include() (line 454 of [warning] /***/sites/default/settings.php). include(): Failed opening '/sites/all/modules/domain/settings.inc' for inclusion (include_path='.:/usr/local/php5/lib/php') in include() (line 454 of [warning] /***/sites/default/settings.php).
    – LLub
    Sep 19, 2011 at 16:27
  • Its seems to be related with the module Domain Access, maybe a difference between your dev and staging ;)
    – yvan
    Sep 19, 2011 at 16:31
  • You are right, it means rsync is not removing anything from staging directory tree it only copies when something is new, isn't it ?
    – LLub
    Sep 19, 2011 at 16:34
  • 1
    Actually, the settings.php is by default exclude by the rsync, but you can change it by adding drush rsync --include-conf @dev @staging more info here
    – yvan
    Sep 20, 2011 at 5:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.