Benji Fisher
February 5, 2019
Thanks for coming!
I know you have many entertainment choices this evening.
Migrate API takes anything into Drupal 8:
Case study: The Economist.com data migration to Drupal
Even the early versions did many things right:
The Migrate API follows the standard ETL approach:
Some people put a lot of effort into this step, so that the next step is simple.
I prefer to do more work in the Transform (process) step. I think there is more opportunity for reusable code there.
There is no Right Way to do it.
font
, blink
, marquee
)This short list is a feature, not a bug.
The Migrate API is written for Drupal. It already “knows” the destination.
Read source | Write destination | |
---|---|---|
Extract | Theory | |
Transform | Practice | Practice |
Load | Theory |
A typical migration project has several migrations, each with its own three stages.
“Several” means dozens. Maybe hundreds.
Migrate All the Things:
Migrate relations between things:
All the stuff your shiny, new site does not have:
If only there were one word …
source:
plugin: d7_node
node_type: article
destination:
plugin: entity:node
default_bundle: article
process:
langcode:
plugin: default_value
source: language
default_value: en
title:
plugin: callback
source: title
callable: trim
status: status
created: created
process:
uid:
plugin: migration_lookup
migration: user
source: node_uid
parent_or_self:
-
plugin: callback
callable: array_filter
source:
- '@parent_tid'
- tid
-
plugin: callback
callable: array_shift
parent_or_self:
-
plugin: callback
callable: array_filter
source:
- '@parent_tid'
- tid
-
plugin: array_shift
parent_or_self:
-
plugin: callback
callable: array_filter
source:
- '@parent_tid'
- tid
-
plugin: callback
callable: array_values
-
plugin: extract
index:
- 0
'field_body/value':
-
plugin: dom
method: import
source: body
-
plugin: dom_apply_styles
format: pega_html
rules:
-
xpath: '//h2'
style: H2
-
plugin: dom
method: export
https://www.drupal.org/project/migrate_plus/issues/2958281 (with Marco Villegas (@marvil07) for Pega)
The Feeds module in D8 should be a front end to the Migrate API.
Plenty of work for people who can handle custom migrations.
Migrations will not always be hard.