Migrating birds

Why You Should Consider Drupal – Painless Migrations

Photo by Ray Hennessy

If you search “why choose Drupal”, many compelling reasons for adopting one of the world’s most powerful CMS solutions pop to the surface: robust and innovative functionality, high extensibility, API-driven flexibility, built-in web services, speed and performance, multilingual support, rich content authoring experiences, 3rd-party integrations, mobile-first responsiveness, and all the other perks that come with using an open source, highly customizable, scalable, secure, and community supported platform like Drupal.

One of the most compelling reasons we think everyone should consider Drupal as the robust enterprise content management framework of choice remains the ease and swiftness with which content can be migrated whether it’s from a legacy database, some other platform, or from an older version of Drupal itself. Along with the host of other great functionality you get out-of-the-box, making content migrations relatively painless lowers the bar immeasurably in making the switch to a platform like Drupal. Depending on the complexity of translating a legacy data model into one that works for a modern web application, the Migrate modules that now ship with Drupal core can make that process a virtual breeze.

On a recent project, we migrated a client’s Drupal 7 site to Drupal 8. With Migrate in core, it was surprisingly straightforward and dare I say easy to move content, massage the data, and populate an empty shell of a site with years of accumulated articles, files, and media. What blew my mind (and our clients’ minds as well) in working with the migration scripts we wrote, is the administrative user interface that works out-of-the-box to allow monitoring of the status of their custom migrations as well as even enable non-technical folks to execute the running of scripts.

A screenshot of the migrations user interface.
A screenshot of the migrations user interface.

This feature came in extremely handy when we had to solve a workflow/editorial problem wherein our client wanted the ability to manually import content from an RSS feed. Migrate to the rescue!

Some context: there are a number of contributed modules still catching up to the version leap to Drupal 8. Feeds is one of them. In Drupal 7, Feeds is a powerful and popular solution for aggregating content from external sources. While the open source community is hard at work porting that module’s features to Drupal 8, we happily discovered that Migrate in Drupal 8 core can handle the task with surprising ease.

To give proper attribution, this post by Campbell Vertesi was the first inkling that we could use Migrate to do the heavy lifting. With just a few mapping of fields in a simple yaml file, our client was thrilled to see the admin UI that empowered them to import content from an external RSS feed. Once the configuration was exported, they could navigate to the migration interface, click a button, and all their content from the feed showed up as content on their site. It was a win for everyone.

Here's the yaml file for the above migration:

id: rss_community
label: 'RSS feed for Community'
status: true
migration_tags:
  - RSS
migration_group: rss

source:
  plugin: url
  data_fetcher_plugin: http
  urls: 'https://rssfeedurl'
  data_parser_plugin: simple_xml

  item_selector: /rss/channel/item
  fields:
    -
      name: guid
      label: GUID
      selector: guid
    -
      name: title
      label: Title
      selector: title
    -
      name: pub_date
      label: 'Publication date'
      selector: pubDate
    -
      name: link
      label: 'Link'
      selector: link
    -
      name: description
      label: 'Description'
      selector: description
    -
      name: tag
      label: 'Tag'
      selector: category

  ids:
    link:
      type: string

destination:
  plugin: entity:node
  bundle: story

process:
  title: title
  'body/format':
    plugin: default_value
    default_value: full_html
  'body/value': description
  'body/summary': link
  field_tags: category
  created:
    plugin: format_date
    from_format: 'D, d M Y H:i:s O'
    to_format: 'U'
    source: pub_date
  status:
    plugin: default_value
    default_value: 0
  type:
    plugin: default_value
    default_value: story
  uid:
    plugin: default_value
    default_value: 1

Ultimately choosing the right CMS for your application depends on a lot of factors. Here at Chromatic, Drupal remains one of our favorite enterprise solutions and it’s easier than ever to make the switch (or upgrade your existing Drupal site) with the help of Migrate in core.

Let us know why you love Drupal @ChromaticHQ !

Related Articles