Drupal 8 - Improved upgrade process

  • 4 minute read

It is my pride and pleasure to announce that Drupal 8 will ship with a migration path from both Drupal 6 and Drupal 7. This is a first for Drupal, and is quite uncommon for most software projects. We love our elderly Drupal sites, and want them to be reborn as shiny new Drupal 8 sites.

Behind this announcement is a major technical change in how Drupal implements major version upgrades. Drupal traditionally uses its update.php page and hook_update_N() functions to update a database to the next version. With each release, this process became more and more awkward to maintain. We were trying to run Drupal 7 on a Drupal 6 database, without the old APIs that understood the data. In the end, the hook_update_N() system only worked for basic sites. Everyone else had switched over to using Migrate module for major version upgrades. So we bit the bullet and brought migrate module into Drupal 8 core.

Migrate is great as it frees you to build a brand new destination site (Drupal 8, in this case), and configure it to your liking. You are liberated to change your Drupal architecture, building upon the lessons learned while operating a D6/D7 site. You can drop the old modules that aren't working for you, and adopt shiny new ones in D8. Once you have D8 installed and nominally configured, you can start migrating your content and configuration from your source site to your destination site. Drupal 8 provides a basic admin web form for initiating this, or you can initiate the migration via Drush. The web form collects simple details — namely your DB credentials for the D6/D7 site. The Drush approach is more powerful and reliable, as you skip the overhead of the batch system. Furthermore, Drush can migrate only parts of your site (e.g. "the first 30 users") and roll them back as you refine the logic of your upgrade. Best of all, Drupal 8 supports incremental migrations so you can stay live on D6/D7 and keep on migrating added/edited content to Drupal 8 on an every x minutes basis. This near real-time migration gives QA and business folks confidence that their new Drupal 8 site meets requirements and is ready for live traffic. Cutting over to Drupal 8 is as simple as pointing your web traffic to the D8 server. You can then retire your source site after enjoying some tasty beverages.

The D8 Migrate code has been updated for D8 conventions like plugins, the state system, the Entity API, etc. Furthermore, "migrations" are now config entities that are represented as easily editable .yml files. Otherwise, this is the Migrate module many of you have known and loved. Migrate was introduced by Mike Ryan and Moshe Weitzman 5 years ago at Drupalcon D.C.. I'm thrilled to see it finally find a home in Drupal core.

Notes:

  1. Minor version updates are unchanged. Developers continue to use hook_update_N() for those.
  2. Contrib and custom modules are encouraged to ship with migrations of their data from D6/D7 to D8. Use core modules as your model.
  3. The underlying Migrate API is source-agnostic. You can easily migrate into D8 from MS SQL, Oracle, piles of HTML files, XML feeds, CSV files, etc.
  4. Similarly, Drupal 4.x and Drupal 5.x sites are able to migrate using this same approach. Let's collaborate on source plugins for these platforms.
  5. Thanks to MongoDB and Acquia for sponsoring chx and Mike Ryan respectively to work on this project. Thanks to Melissa Anderson who is project managing.