ahoyapi: v2
commands:
  pull:
    cmd: |
      drush sql:sync --create-db @default.live @default.dev
      drush @default.dev cr
      drush -y @default.dev config-split:import develop
      drush rsync @default.live:%files/ @default.dev:%files -- --chown=www-data:www-data --safe-links --max-size=20M
      drush rsync @default.live:%private/ @default.dev:%private -- --chown=www-data:www-data --safe-links --max-size=20M
      chmod -R ugo+w files/default/files
      chmod -R ugo+w files/default/private
    usage: Pull files and DB from live site
  pull-sql:
    cmd: |
      drush sql:sync --create-db @default.live @default.dev
      drush @default.dev cr
      drush -y @default.dev config-split:import develop
    usage: Pull DB from live site
  pull-files:
    cmd: |
      drush rsync @default.live:%files/ @default.dev:%files -- --chown=www-data:www-data --safe-links --max-size=20M
      drush rsync @default.live:%private/ @default.dev:%private -- --chown=www-data:www-data --safe-links --max-size=20M
      chmod -R ugo+w files/default/files
      chmod -R ugo+w files/default/private
    usage: Pull files from live site
  convert2mariadb:
    cmd: |
      drush @default.live ssh "drush eval \"print(\Drupal::database()->getConnectionOptions()['database'])\" | xargs -I % mysql --defaults-file=~/.my.cnf --execute 'select concat(\"alter table \",TABLE_SCHEMA,\".\",TABLE_NAME,\" CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;\") from information_schema.TABLES where TABLE_SCHEMA=\"%\" and TABLE_COLLATION=\"utf8mb4_0900_ai_ci\"' | grep ^alter | mysql --defaults-file=~/.my.cnf"
