Preparing for Upgrade

In my previous post, I described why I was upgrading a website from Drupal 6 to Drupal 8 and some of the key considerations. Note that many of these are likely required to upgrade from Drupal 7.

For this post, I will install the Drupal Migration Modules.

From Preparing an Upgrade I will check:

A fresh installation of Drupal 8 with the core module Migrate Drupal enabled.

Access to the Drupal 6 database and site files from the Drupal 8 site.

The Migrate Upgrade module installed and enabled on the Drupal 8 site. If you plan on running the upgrade from Drush, you’ll need Drush 8 and the module Migrate tools. Using Drush is more robust and allows selective migration. But it requires an additional module and it must be run from the command line.

Installing Drush 8 Locally

Executing an upgrade using Drush describes that the latest Drush needs to be used to upgrade - so lets’ get it.

I will install Drush using Homebrew package manager as described in Install Drush on a Mac

I already have Homebrew installed, otherwise I followed the commands on Installing Drush on Mac using Homebrew

Issue - The above methods caused all kinds of errors on install and may not be the best way for Drush 8 or Drupal 8 as described at Installing Drush 8 using Composer

Before installing, I decided to change the default MAMP document folder to be in my usual /Sites/ folder :

updated MAMP site root folder

The local URL now looked like this:

updated Drupal 8 local URL

Drush was then installed with Composer using instruction at Install a global Drush via Composer :

Step 1 - Install Composer Globally

cd /Sites/drupal8
curl -sS | php
mv composer.phar /usr/local/bin/composer

installing composer

Step 2 - Add Composer to my bash_profile

cd /Users/hywel
nano .bash_profile

Add the following line

export PATH="$HOME/.composer/vendor/bin:$PATH"

Start a new Terminal session to ensure the path is updated

Step 3 - Install Drush using Composer and verify Status

cd /Users/hywel/Sites/drupal8
composer global require drush/drush
drush status

installing drush with composer

drush 8 status

Step 4 - Update Path to ensure systems uses the MAMP version of PHP

cd /Users/hywel
nano .bash_profile

Add the following lines:

export MAMP_PHP=/Applications/MAMP/bin/php/php7.0.0/bin

update path to MAMP php

Step 5 - Install the Migration Modules

Executing an upgrade using Drush describes:

To migrate using Drush you need to download and enable the Migrate Upgrade contributed module. You will also need Migrate Tools if you plan on doing more than running a one-time complete upgrade.

Drush has extensive functionality to install and maintain Drupal - see the Drush Site and Drush Commands.

To install and enable the contributed modules :

cd /Users/hywel/Sites/drupal8
drush dl migrate_upgrade
drush en migrate_upgrade

The first part worked:

drush dl migrate_upgrade

Issue: Drush was not able to start (bootstrap) the Drupal database drush en migrate_upgrade issue

julianlmedina and Installing Drush on Mac using Homebrew have described

If you are running your Drupal sites with MAMP, you need to tell Drush to use MAMP’s mysql.sock or you will run into the following error. Easiest way to do this is by creating a symlink

sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

MAMP mysql sock

Now to retry..

cd /Users/hywel/Sites/drupal8
drush en migrate_upgrade

Issue: Drush still could not connect with the same error as before - I determined that the mysql command was not available from /Users/hywel/Sites/drupal8 with MAMP Following the instructions at Solving mysql command not found” on MAMP

cd /Users/hywel
nano .bash_profile

Add this line to .bash_profile:

export PATH=$PATH:/Applications/MAMP/Library/bin

Now to retry..

cd /Users/hywel/Sites/drupal8
drush en migrate_upgrade

migrate upgrade enable success

cd /Users/hywel/Sites/drupal8
drush dl migrate_tools
drush en migrate_tools

migrate tools success

Success - Do you want to continue… yes I think so! See you next time.