diff --git a/README.md b/README.md index ac69d8c8f5208834f0634706a5ad834aa78d96ea..633cbfa937dced90d6f7b24e32f561154f2a1e57 100644 --- a/README.md +++ b/README.md @@ -190,60 +190,68 @@ To overwrite the default settings for the Docker environment, add the relevant p { "extra": { "docker4drupal": { - "projectname": "[NAME OF CURRENT DIRECTORY]", - "live": { - "root": "", - "uri": "", - "host": "", - "user": "" - }, - "drupal": { - "version": 8 - }, - "php": { - "version": "7.0", - "xdebug": 1 - }, - "webserver": { - "type": "nginx", - "version": "1.13" - }, - "varnish": { - "enable": 0 - }, - "redis": { - "version": "4.0" - }, - "dbbrowser": { - "type": "pma" - }, - "solr": { - "enable": 0, - "version": "6.6" - }, - "node": { - "enable": 0, - "key": "", - "path": "" - }, - "memcached": { - "enable": 0 - }, - "rsyslog": { - "enable": 0 - }, - "athenapdf": { - "enable": 0, - "key": "" - }, - "blackfire": { - "enable": 0, - "id": "", - "token": "" - }, - "webgrind": { - "enable": 0 + "projectname": "[NAME OF CURRENT DIRECTORY]", + "live": { + "root": "", + "uri": "", + "host": "", + "user": "" + }, + "drush": { + "sql": { + "tables": { + "structure": ["cache", "cache_*", "history", "search_*", "sessions", "watchdog"], + "skip": ["none"] + } } + }, + "drupal": { + "version": 8 + }, + "php": { + "version": "7.0", + "xdebug": 1 + }, + "webserver": { + "type": "nginx", + "version": "1.13" + }, + "varnish": { + "enable": 0 + }, + "redis": { + "version": "4.0" + }, + "dbbrowser": { + "type": "pma" + }, + "solr": { + "enable": 0, + "version": "6.6" + }, + "node": { + "enable": 0, + "key": "", + "path": "" + }, + "memcached": { + "enable": 0 + }, + "rsyslog": { + "enable": 0 + }, + "athenapdf": { + "enable": 0, + "key": "" + }, + "blackfire": { + "enable": 0, + "id": "", + "token": "" + }, + "webgrind": { + "enable": 0 + } } } } diff --git a/src/Handler.php b/src/Handler.php index 1c476bd4e28a6536cc1ea8daf44752d576a76066..0137228025b33972f09d975875b065b2b963bd58 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -222,6 +222,14 @@ class Handler { 'host' => '', 'user' => $env->receive('live_host_username', 'Remote username for host of the live site', getenv('USER')), ], + 'drush' => [ + 'sql' => [ + 'tables' => [ + 'structure' => ['cache', 'cache_*', 'history', 'search_*', 'sessions', 'watchdog',], + 'skip' => ['none',], + ], + ], + ], 'drupal' => [ 'version' => '8', ], diff --git a/templates/drushrc.php.twig b/templates/drushrc.php.twig index 0ebe65e72a30ac62b29bcb2d789fc4cd85b30809..d710fd2042f6bdc3d5c20e045c749b1d271be9ca 100644 --- a/templates/drushrc.php.twig +++ b/templates/drushrc.php.twig @@ -1,7 +1,8 @@ <?php -$options['structure-tables']['common'] = array('cache', 'cache_*', 'history', 'search_*', 'sessions', 'watchdog'); +$options['structure-tables']['common'] = array('{{ drush.sql.tables.structure|join('\', \'')|raw }}'); +$options['skip-tables']['common'] = array('{{ drush.sql.tables.skip|join('\', \'')|raw }}'); -$options['shell-aliases']['pull-sql'] = '!drush -y --create-db --structure-tables-key=common sql-sync @live @dev && drush -y @dev {{ (drupal.version == 8) ? 'cr' : 'cc all' }} && drush -y @dev dev on'; +$options['shell-aliases']['pull-sql'] = '!drush -y --create-db --structure-tables-key=common --skip-tables-list={{ drush.sql.tables.skip|join(',') }} sql-sync @live @dev && drush -y @dev {{ (drupal.version == 8) ? 'cr' : 'cc all' }} && drush -y @dev dev on'; $options['shell-aliases']['pull-files'] = '!drush -y rsync @live:%files @dev:%files --mode=rlDzq --chown=www-data:www-data --safe-links --max-size=20M && drush -y rsync @live:%private @dev:%private --mode=rlDzq --chown=www-data:www-data --safe-links --max-size=20M'; $options['shell-aliases']['pull-all'] = $options['shell-aliases']['pull-sql'] . ' && ' . $options['shell-aliases']['pull-files'];