Skip to content

Instantly share code, notes, and snippets.

@heddn
Last active February 15, 2018 20:22
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 heddn/38d0358c86b4f6d7e972628460ee8713 to your computer and use it in GitHub Desktop.
Save heddn/38d0358c86b4f6d7e972628460ee8713 to your computer and use it in GitHub Desktop.
Migrate
=======
A data import or migration consists of three phases: extract, transform, load.
Extract/Source plugins
----------------------
For the extract phase Migrate has source plugins. Compared to Feeds, the source plugins seems to be responsible for both
fetching and parsing. The SQL source is the most commonly used source plugin. Unlike Feeds, for SQL based sources, a custom
source must exist for every combination of database source type (d6, d7, wordpress, etc.) and data type (files, users, nodes).
For XML based sources (and likely also for JSON and CSV based sources) it works more like Feeds: one configurable source plugin.
(I'm currently still examining this source type).
Transform/Process plugins
-------------------------
For the transform phase, Migrate has process plugins. These can manipulate the data and are comparable to Feeds Tamper.
A difference with Feeds Tamper is that a process plugin acts on the mapping, leaving the source intact. This means for
every mapper, you start with the same unaltered source data. Feeds Tamper, on the other hand, alters the incoming source,
*before* mapping takes place. With Feeds Tamper you'll need to take a copy of a source value first if you want to have two
manipulated versions of it.
Load/Destination plugins
------------------------
For the load phase, Migrate has destination plugins. These are responsible for saving the data to Drupal. They seem to be the
equivalent to Feeds processors. In the examples I encountered so far I only saw 'entity:' destination plugins. I suspect they
also fulfill the role of Feeds target plugins, but I'll have to examine them closer to be sure.
Highwater marks
---------------
These exist to prevent importing an item that has not changed. Looks like to be the equivalent of hash check in Feeds.
Need to take a closer look.
Migration group
---------------
Contains a list of related migrations that need to be performed in a certain order. Feeds has no equivalent for this concept.
Migration entity
----------------
A configurable object for custom migrations (entity type is defined by the Migrate Plus module).
Migration templates
-------------------
Default configuration for a specific data type. Each module that defines a data type and existed in D6 or D7, should provide a
migration template: one for D6 and one for D7. For content entities this is more important than for config entities. For some
config entity types it may not be worth the effort to provide a migration possibility: for example if they are very complex,
like Views.
Schematic they are the same as migration entities. Other than migration entities, migration templates cannot be executed
directly.
The closest equivalent to this concept in Feeds are - in D7 - Feeds importers exported into code. In D7, Feeds importers existing
in code could be overridden on the site and be reverted to the default. In D8, Feeds only has an equivalent for migration
entities: feed types.
Stubs
-----
Used to create placeholder entities when an other migration that creates the actual entities runs later. Stubs are needed when a
migration wants to import an entity reference, but the referenced entity doesn't exist yet. Feeds has no equivalent for this
concept.
Modules
-------
With Drupal core alone you can only perform Drupal to Drupal migrations. These migrations are not customizable: you can only
import everything (that is supported) from your old Drupal site.
With Migrate Plus you can create custom migrations. It also contains examples and source plugins for XML and JSON.
The Migrate Upgrade module helps with generating migration entities for Drupal to Drupal migrations, so that these type of
migrations become customizable.
The Migrate Tools module has drush commands (and an UI in progress) to manage custom migrations.
A migration requires a plan
---------------------------
When you want to perform a large migration (like a Drupal to Drupal one) it is important to plan the migration in detail: are all
needed modules available in D8? Is there content that does not need to be migrated? What are the benefits of the migration? Are
there features from the old Drupal site that can be dropped?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment