Migrating data

by Gisle Hannemyr

This chapter contains notes on migrating nodes, users and other entities into a Drupal website. It discusses tools to migrate data between staging and production, tools to migrate data as part of upgrading to a newer version of Drupal, and lso discusses tools to migrate data from a non-Drupal website to Drupal.

Table of contents

Drupal projects discussed in this chapter: Node export, WordPress Migrate.

Introduction

This chapter is about migrating entities (mainly nodes) between websites built on non-compatible code bases.

Before starting data migration, it is recommended yo read the following documentation:

Alternative methods

Browser

This method migrates all content and users as well as the configuration. It does not provide much control over the process, but should work well on simpler Drupal 7 web sites without much customization.

Source: DO: Upgrade using web browser.

Drush

Source: DO: Upgrade using web browser.

Drupal extensions

These are the main extensions provided to help with migrations. Most of these are meant to be used along with drush.

Other contributed Drupal extensions

The notes below are on specific Drupal extensions that I've evaluated. These are:

Node export

The Node export project (8.x-1.0-alpha1) allows users to export nodes and then import it into another Drupal installation, or on the same site.

The use case for this extension is exporting legacy nodes to new Drupal versions, or export/import nodes between a staging and a production site running the same version of Drupal.

Can transfer data via files, or by copy-pasting.

You will need the same content types on both sites for the imports to work correctly, and ideally also relevant compatibility with fields, and modules.

It has 37K installs (2021-08). Uses UUID to maintain cross-reference.

Simple and intuitive interface. Instructions in README.txt. For quick export-import, copy-paste between text blocks.

I've used it migrating content between alternate Drupal 7 development sites in the custom RBG project.

WordPress Migrate

The WordPress Migrate project (8.x-3.0-alpha5) helps migrating WordPress content into Drupal. It leverages Migrate Tools, Migrate Plus, CTools the Migrate API.

I used it to migrate Morten's blog into Titan for Drupal 7. See “Appedix A: WP migration” in Titan implementation notes for a description of the process.

See alsoSee also: agiledrop.com: Migrate WordPress to Drupal. It is a tutorial about how to use this extension to export XML from WordPres and import it into a Drupal site using WordPress Migrate.

There is also: github.com/amitgoyal/d8_migrate_wordpress. I haven't tested it.

Other contributed Drupal extensions

This is a list of unreviewed modules that may be helpful for migrating content. The number is the number of reported users (as of August 2021),

The following only exists for D7 and are probably obsolete:

Scraping and cleaning

To scrape and clean, wget is handy, followed by a perl-script that extract the main page content. See scrape_site.sh for example of how to use wget, and clean.pl for cleaning. The most recent incarnations was below the staging area of the PVN extranet [now lost].

Final word

Related chapters:

Other useful pages:


Last update: 2021-08-29 [gh].