Here you are, facing a major challenge: you'll be moving your “precious” site (or your client's site, but still “precious” for him/her and for your own reputation) to Drupal 8! This is process is called: the Drupal 8 migration.
 
What if something goes terribly wrong? What if you lose valuable information during the process? What if the final look and functions turn out to be less amazing than what you've already heard and read about the highly praised Drupal 8?
 
No need to freak out, we're here to reassure you: you've taken the best decision!
 
Moreover, we're here to help you with a risks-minimizing and workflow efficiency-boosting guide that will show you how to upgrade your dear website and have it running in Drupal 8 in no time! It's all about a little bit of planning and putting all the implied processes into place, that's all!
 
Speaking Drupal 8 migration, just to make it clear, we'd like to mention that: although the whole website migrating process includes configuration migration, updating your websites theme and content migration, too, we'll be focusing on content migration only in this post (by far the most "daunting" one).
 

Effective Drupal 8 migration: Its 5 Main Phases

Before you proceed with any one of your future Drupal 8 migration projects, we strongly advise you to take your time to go over these 5 major steps to take if you want to ensure your projects' success:
 
1. Audit Your Source Site
  • analyze the site to be migrated, see how its content is structured, how it looks, what it uses
  • to examine its taxonomy terms, users, menus, fields, content types, in a few words: don't let anything skip your "inspection"
 
2. Plan Your Data Model:
  • once you've closely analyzed the source website, it's time you (and your team and client) took some major decisions: what stays on, what should be removed, what corrections/modifications should be performed. To put it simply: it's now that you plan out the content that the future Drupal 8 site will display
       
3. Get Everything Prepared for Migration:
  • at this stage you'll first overview and then make use of the contributed modules, you'll work with Migrate API, configure and run your migration 
     
4. Put Together Your Migration Strategy:
  • hopefully (for this is the best practice for reducing downtime) at this phase of the whole migration process you'll opt for a near-continuous content migration variant
     
5. Launch Migration:
  • set up a timeline and be prepared to mitigate any risks that might arise (either before or post launching)
     

A Drupal 8 Content Migration Example

 
Before we proceed with the “enlightening” Drupal 8 migration example that we've promised you, let's have a quick look at the modules which will make the whole “transition” to Drupal 8 possible?
 
  • Migrate Module: part of Drupal 8 core, this module will serve you both with the content and the site's configuration migration process
     
  • Migrate Plus: comes with additional functionality (you get to migrate from XML, JSON and CSV formats)
     
  • Drupal Upgrade: it's the one to install if you want to operate in a web interface (which will enable you to specify the files directory and the database of your core site. Once the migration has been completed, you'll get to see all the successfully migrated entities in the report that it will provide you).
     
Warning!!! Don't forget to back up your future Drupal 8 website!
 
Now here's that migration example! It briefly describes all the steps to take for migrating the files that Drupal 8's Migration module won't migrate (images here included).
 

1. Migrate Your Website's Background

Let's imagine the following task from your Drupal 8 migration project: you need to import TV shows into Article nodes (from Tvmaze's JSON API).
 
You'll have to define our YAML file, migrate.migration.shows.yml
 
id: shows
label: 'TV shows'
source:
  plugin: json_source
  path: 'https://goo.gl/uKiuxw identifier: id
  identifierDepth: 1
  headers: {  }
  fields: {  }
  constants:
    type: article
    format: restricted_html
destination: plugin: 'entity:node'
process:
  title: name
  body/0/value: summary
  body/0/format: constants/format
  type: constants/type
 
Can you identify the 3 main section here?
 
  • source: it informs migrate about the “source” that our content comes from . 
  • destination: it lets migrate know what exactly is it that we want to generate (in the above example: nodes)
  • process: this section informs migrate that it should turn JSON into Drupal fields (summary turns into node body, while the name from JSON becomes the node title)
     

2. Write a Process Plugin

The next step one on our wish list is “adding images”.
 
Since it's not the URL of the poster image that we'd like to add, but its contents themselves, we face the second challenge of this 3 steps migration process: writing a process plugin (since there's none, already available in Drupal 8, that actually downloads a URL) that will enable us to transform our URL.
 
So, we inherit from ProcessPluginBase and apply the transform() method which handles $value as a URL.
 

Next, once we get our plugin's name (file_import), we'll update our process section:

 

process:
  # snip
  field_image:
    - source: image/original
      plugin: file_import
 

3. Run Migration

Here are the 3 last steps to take for finally running your content into the Drupal 8 migration process:
 
  • check whether all the proper modules are installed: the Migrate Tools module,  migrate_source_json and the custom one, with the process plugin that you will have already written
  • import your YAML file 
  • run migration with Drush's migrate commands:  drush migrate-import shows
 
And this is how you migrate images and other types of files (other than SQL dumps or JSON files) to Drupal 8! Was is hard? Do you find the Drupal 8 migration of content a complicated process? Feel free to share your thoughts!
Development

We do Drupal development

Go to our Drupal page!

Visit page!

Browse cities

Recommended Stories

Drupal Commerce: Building Powerful E-commerce Solutions
E-commerce sales are projected to reach $6.3 trillion globally by the end of 2024. With online shopping… (Read more)
10 Minutes /
Choosing the Right Drupal Distribution: A Guide for Businesses
Choosing the perfect Drupal distribution can feel like navigating a maze—especially for businesses and government… (Read more)
10 minutes /
How OPTASY Creates Client-Centric Drupal Experiences
Agile methodology has revolutionized the way web development projects are executed, particularly for complex… (Read more)
7 minutes /