Skip to content

Instantly share code, notes, and snippets.

@juampynr
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juampynr/27cdd7f5c358ac9ec1fa to your computer and use it in GitHub Desktop.
Save juampynr/27cdd7f5c358ac9ec1fa to your computer and use it in GitHub Desktop.
Upgrading Drupal core and contrib

Pre-upgrade steps:

# Start by fetching production's database.
drush syncdb @prod @local

# Make sure your main branch is up to date:
git checkout master
git pull --rebase

Upgrading core

Given that:

  • Your repository has Drupal core at /docroot.
  • You keep patches at /patches and a reference at /patches/README.md.
# Create a new branch for this upgrade so it can be peer reviewed:
git checkout -b ticket-number-upgrade-core-7-xx

# Bring on the new core version.
# Drush takes care of removing core files that are not present
drush up drupal

# If core was patched, review if patches were committed and update
# docroot/../patches/README.md accordingly (assuming that you keep track of
# patches at docroot/../patches/).

# Update the database and look for errors or warnings.
(cd docroot && drush rr -v && drush updatedb -v -y && drush fra -y -v)

# Run automated tests (if available) and test manually.
# If everything worked as expected. Commit and push:
git add -A .
git commit -m "Upgrade core to 7.xx"
git push -u origin ticket-number-upgrade-core-7-xx

# Ask someone else to test it before merging it.

Upgrading contrib modules

Given that:

  • Contrib modules are located at /docroot/sites/all/modules/contrib.
  • Patches are kept at /patches and a reference at /patches/README.md.

Check the release notes of every version ahead of the current version to see if there are any blockers. If there are no blockers, proceed to the upgrade:

# Create a branch for this upgrade
git checkout -b ticket-number-upgrade-modulename-to-XX

# Download the new version
(cd docroot && drush dl modulename)

# Check docrot/patches to see if this module was patched and, if so, check whether
# patches are committed already or if you need to patch the new version as well.

# Update the database and look for errors or warnings.
(cd docroot && drush rr -v && drush updatedb -v -y && drush fra -y -v)

# Run tests and check manually the site.

# Commit and push your changes.
git add -A .
git commit -m "Ticketnumber Upgrade module modulename to XX"
git push -u origin ticket-number-upgrade-modulename-to-XX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment