From cdf140864e209818b767ab725a5f099c84902284 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Sun, 4 Feb 2018 12:58:14 +0000
Subject: [PATCH] #21 Update drush/sites/default.site.yml and drush/drush.yml
 for Drush 9

---
 README.md                                     |  9 ++++--
 src/Handler.php                               |  8 ++++--
 ...}.alias.yml.twig => default.site.yml.twig} |  0
 templates/drush.yml.twig                      | 28 ++++++++++++++-----
 4 files changed, 32 insertions(+), 13 deletions(-)
 rename templates/{{{ projectname }}.alias.yml.twig => default.site.yml.twig} (100%)

diff --git a/README.md b/README.md
index dc957a1..2866dd9 100644
--- a/README.md
+++ b/README.md
@@ -208,7 +208,7 @@ To overwrite the default settings for the Docker environment, add the relevant p
         "sql": {
           "tables": {
             "structure": ["cache", "cache_*", "history", "search_*", "sessions", "watchdog"],
-            "skip": ["none"]
+            "skip": ["migration_*"]
           }
         }
       },
@@ -360,8 +360,11 @@ alias cps "docker-compose ps"
 alias clogs "docker-compose logs"
 alias cstop "docker-compose stop"
 alias cstart "docker-compose start"
-alias cshell "docker-compose exec -u root php sh"
-alias cdrush "docker-compose exec -u root php drush"
+alias cshell "docker-compose exec --user root php sh"
+alias cdrush "docker-compose exec --user root php drush"
+alias cdrush-pull "cdrush-pull-sql; and cdrush-pull-files"
+alias cdrush-pull-sql "cdrush sql:sync --create-db @default.live @default.dev; and cdrush @default.dev cr; and cdrush @default.dev dev on"
+alias cdrush-pull-files "cdrush rsync @default.live:%files/ @default.dev:%files -- --chown=www-data:www-data --safe-links --max-size=20M"
 ```
 
 Do that once, it will pay back in a magnitude.
diff --git a/src/Handler.php b/src/Handler.php
index 781f563..f077c41 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -225,8 +225,8 @@ class Handler {
       'drushrc.php' => [
         'dest' => $projectRoot . '/drush',
       ],
-      '{{ projectname }}.alias.yml' => [
-        'dest' => $projectRoot . '/drush',
+      'default.site.yml' => [
+        'dest' => $projectRoot . '/drush/sites',
         'add2yaml' => TRUE,
       ],
       'drush.yml' => [
@@ -269,7 +269,9 @@ class Handler {
               'sessions',
               'watchdog',
             ],
-            'skip' => ['none'],
+            'skip' => [
+              'migration_*',
+            ],
           ],
         ],
       ],
diff --git a/templates/{{ projectname }}.alias.yml.twig b/templates/default.site.yml.twig
similarity index 100%
rename from templates/{{ projectname }}.alias.yml.twig
rename to templates/default.site.yml.twig
diff --git a/templates/drush.yml.twig b/templates/drush.yml.twig
index 0553e3a..f6dd530 100644
--- a/templates/drush.yml.twig
+++ b/templates/drush.yml.twig
@@ -1,19 +1,33 @@
 drush:
   paths:
+    config:
+      - '${env.home}/.drush/config/drush.yml'
     include:
       - './drush/contrib'
 options:
   uri: 'http://{{ projectname }}.docker.localhost:8000'
 command:
+  core:
+    rsync:
+      options:
+        mode: 'rlDzq'
   sql:
-    options:
-      structure-tables:
-        common:
+    sync:
+      options:
+        structure-tables-key: 'common'
+        skip-tables: 'common'
+    dump:
+      options:
+        structure-tables-key: 'common'
+        skip-tables: 'common'
+sql:
+  structure-tables:
+    common:
 {% for table in drush.sql.tables.structure %}
-          - '{{ table }}'
+      - '{{ table }}'
 {% endfor %}
-      skip-tables:
-        common:
+  skip-tables:
+    common:
 {% for table in drush.sql.tables.skip %}
-          - '{{ table }}'
+      - '{{ table }}'
 {% endfor %}
-- 
GitLab