SlideShare a Scribd company logo
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
April 2018
D8 - 220K websites
D7 - 900K websites
D6 - 60K websites
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
destination:
plugin: entity:user
/**
* @MigrateDestination(
* id = "entity:user"
* )
*/
class EntityUser extends EntityContentBase {
protected function save(ContentEntityInterface $entity, array $old_destination_id_values
= []) {
$entity->save();
return [$entity->id()];
}
Migrating Drupal 7 to Drupal 8
roles: #roles are on a different table, but it is part of the user entity
plugin: migration_lookup
migration: d7_user_role
source: roles
roles: #roles are on a different table, but it is part of the user entity
plugin: migration_lookup
migration: d7_user_role
source: roles
# for nodes
destination:
plugin: 'entity:node'
default_bundle: admissions_event
# for user
destination:
plugin: 'entity:user'
source:
plugin: d7_user
# show User.php
Migrating Drupal 7 to Drupal 8
class User extends FieldableEntity {
/**
* {@inheritdoc}
*/
public function query() {
return $this->select('users', 'u')
->fields('u')
->condition('u.uid', 0, '>');
}
Migrating Drupal 7 to Drupal 8
public function fields() {
$fields = [
'uid' => $this->t('User ID'),
'name' => $this->t('Username'),
];
return $fields;
}
User::fields are the source data you can use later in process section of the template.
/**
* Drupal 7 user source from database.
*
* @MigrateSource(
* id = "d7_user",
* source_module = "user"
* )
*/
class User extends FieldableEntity {
being confident of this, that he who began a
good work in you will carry it on to completion
until the day of Christ Jesus.
# mapping using the short notation (implicitly uses get process plugin)
# destination:source
process:
uid: uid
name: name
pass: pass
mail: mail
# explicit mapping
# <destination_field>:
# plugin: <plugin_name>
# source: <source_field>
process:
langcode:
plugin: user_langcode
source: language
fallback_to_site_default: false
roles:
plugin: migration_lookup
migration: d7_user_role
source: roles
user_picture:
-
plugin: default_value
source: picture
default_value: null
-
plugin: migration_lookup
migration: d7_file
/**
* @MigrateProcessPlugin(
* id = "migration_lookup_neiu_current_vid"
* )
*/
class NeiuCurrentVid extends Get {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row
$row, $destination_property) {
$node = node_load($value);
return $node->getRevisionId();
}
}
Migrating Drupal 7 to Drupal 8
# syntax
drush migrate-upgrade --configure-only --legacy-root=<website root> --legacy-db-key=<DB
key> --migration-prefix=<Migration Prefix>
Where:
legacy-root is for example http://mywebsite.com
legacy-db-key is your source d6/d7 db export defined in settings.php
migration-prefix is any value that will be used as a prefix for the files generated for migration
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
process:
nid: tnid #remove this line
vid: vid #remove this line
uid:
#migration_lookup is used to get the new uid from a previous user migration
plugin: migration_lookup
migration: hub_d7_user #the migration id of the previous user migration
source: uid
Migrating Drupal 7 to Drupal 8
Freedom lies in being bold
1. Import the source database and define the connections in settings.php
2. Generate the migration template files using migrate_upgrade module:
drush migrate-upgrade --configure-only --legacy-root=<website root> --legacy-db-key=<DB key>
--migration-prefix=<Migration Prefix>
3. Export the migration template files using drush config-export:
drush cex
*** We need to export because it only exists in DB prior to this. Exporting will give the files to edit.
4. Edit/Delete the migration templates files into your config directory as needed.
*** Ideally, you will just be migrating content, users and taxonomy. Configurations/content types can be manually created.
5. Reimport your changes using drush config-import:
drush cim
6. Visit admin/structure/migrate and execute migrations (or rollback) as needed.
Usually migrations are not as desired on the first run and edits to the custom plugin or template must be
made. You can execute rollback and retry. If migration template changes are needed, step 5 must be
executed for template changes to take effect.
1. Migrate Tools contrib module for using drush to execute migrations.
2. Migrate Manifest contrib to group migrations in a manifest file.
3. Using stubs for migrating chicken or egg scenarios.
Go forth and multiply

More Related Content

What's hot (17)

PDF
jQuery secrets
Bastian Feder
 
PDF
Doctrine and NoSQL
Benjamin Eberlei
 
PDF
Doctrine for NoSQL
Benjamin Eberlei
 
PDF
Drupal Step-by-Step: How We Built Our Training Site, Part 1
Acquia
 
PPTX
Simple blog wall creation on Java
Max Titov
 
PPTX
Анатолий Поляков - Drupal.ajax framework from a to z
LEDC 2016
 
ZIP
Django at the Disco
Richard Leland
 
PDF
Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...
DicodingEvent
 
PDF
Django at the Disco
Richard Leland
 
PPT
Backbone js
husnara mohammad
 
PDF
Understanding backbonejs
Nick Lee
 
ZIP
Drupal Development
Jeff Eaton
 
PDF
Dependency Injection
Rifat Nabi
 
PPTX
Php5
Ansh Khurana
 
PDF
Codeigniter : Custom Routing - Manipulate Uri
Abdul Malik Ikhsan
 
PDF
Databinding and Performance-Tuning in Angular 2
Manfred Steyer
 
PPTX
Save data in to sqlite
Junifar hidayat
 
jQuery secrets
Bastian Feder
 
Doctrine and NoSQL
Benjamin Eberlei
 
Doctrine for NoSQL
Benjamin Eberlei
 
Drupal Step-by-Step: How We Built Our Training Site, Part 1
Acquia
 
Simple blog wall creation on Java
Max Titov
 
Анатолий Поляков - Drupal.ajax framework from a to z
LEDC 2016
 
Django at the Disco
Richard Leland
 
Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...
DicodingEvent
 
Django at the Disco
Richard Leland
 
Backbone js
husnara mohammad
 
Understanding backbonejs
Nick Lee
 
Drupal Development
Jeff Eaton
 
Dependency Injection
Rifat Nabi
 
Codeigniter : Custom Routing - Manipulate Uri
Abdul Malik Ikhsan
 
Databinding and Performance-Tuning in Angular 2
Manfred Steyer
 
Save data in to sqlite
Junifar hidayat
 

Similar to Migrating Drupal 7 to Drupal 8 (20)

PDF
Migrating data to Drupal 8
F.L. Jonathan Araña Cruz
 
PPTX
Drupal 8 migrate!
Pavel Makhrinsky
 
PDF
Migrating to Drupal 8: How to Migrate Your Content and Minimize the Risks
Acquia
 
PPT
Dcm migration
Piyuesh Kumar
 
PDF
Migrate
cherryhillco
 
PDF
Migrating data to drupal 8
Ignacio Sánchez Holgueras
 
PDF
Migrate 140123161042-phpapp02
Gaurav Varshney
 
PDF
Migrating data into Drupal using the migrate module
Johan Gant
 
PDF
Migrating to Drupal 8
Alkuvoima
 
PDF
Migrate to Drupal 8
Claudiu Cristea
 
PDF
Drupal migrate-june2015
Suzanne Dergacheva
 
PPTX
Drupal 8 migrate!
Andy Postnikov
 
PDF
Migrate all the things!
Dave Vasilevsky
 
PPT
PPPA D8 presentation Drupal For Gov_0
Stan Ascher
 
PPTX
Drupal content-migration
Ashok Modi
 
PDF
Drupal upgrades and migrations. BAD Camp 2013 version
David Lanier
 
PPT
A pain free migraine
Dennis Solis
 
PDF
Drupal Migrations in 2018
Pantheon
 
PDF
Intro to Drupal Migrate for Site Builders
Suzanne Dergacheva
 
PPTX
The long and the short of migrating to Drupal
jeremyfrench
 
Migrating data to Drupal 8
F.L. Jonathan Araña Cruz
 
Drupal 8 migrate!
Pavel Makhrinsky
 
Migrating to Drupal 8: How to Migrate Your Content and Minimize the Risks
Acquia
 
Dcm migration
Piyuesh Kumar
 
Migrate
cherryhillco
 
Migrating data to drupal 8
Ignacio Sánchez Holgueras
 
Migrate 140123161042-phpapp02
Gaurav Varshney
 
Migrating data into Drupal using the migrate module
Johan Gant
 
Migrating to Drupal 8
Alkuvoima
 
Migrate to Drupal 8
Claudiu Cristea
 
Drupal migrate-june2015
Suzanne Dergacheva
 
Drupal 8 migrate!
Andy Postnikov
 
Migrate all the things!
Dave Vasilevsky
 
PPPA D8 presentation Drupal For Gov_0
Stan Ascher
 
Drupal content-migration
Ashok Modi
 
Drupal upgrades and migrations. BAD Camp 2013 version
David Lanier
 
A pain free migraine
Dennis Solis
 
Drupal Migrations in 2018
Pantheon
 
Intro to Drupal Migrate for Site Builders
Suzanne Dergacheva
 
The long and the short of migrating to Drupal
jeremyfrench
 
Ad

More from Promet Source (20)

PPTX
How To Start Building Your Own Website With Drupal by Mary Chris Casis
Promet Source
 
PDF
DrupalCamp Cebu 2018 R&F by Andrew Kucharski
Promet Source
 
PDF
Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018
Promet Source
 
PDF
Migrating to-Drupal-8 by Bryan Manalo
Promet Source
 
PDF
Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018
Promet Source
 
PDF
Drupal Development with Docker
Promet Source
 
PPTX
Web Accessibility in Drupal
Promet Source
 
PDF
Drupal Continuous Integration and devops - Beyond Jenkins
Promet Source
 
PDF
Drupal 8 Involvement with Promet Source
Promet Source
 
PDF
Using Commerce License for Premium Content on Drupal Sites
Promet Source
 
PDF
Behavioral driven development with Behat
Promet Source
 
PDF
Composer tools and frameworks for Drupal
Promet Source
 
PDF
Responsive Design Testing the Promet Way
Promet Source
 
PDF
Optimize and succeed your next Fixed Budget Project planning process
Promet Source
 
PDF
Diy continuous integration
Promet Source
 
PPT
Higher Ed Web 2013 presentation - Field of Dreams, build it and they will come
Promet Source
 
PPTX
Getting agile with drupal
Promet Source
 
PPT
Project Estimation Presentation - Donte's 8th level of estimating level of ef...
Promet Source
 
PDF
DrupalCon 2013 Making Support Fun & Profitable
Promet Source
 
PDF
DevOps for Drupal: Why We Cook With Chef
Promet Source
 
How To Start Building Your Own Website With Drupal by Mary Chris Casis
Promet Source
 
DrupalCamp Cebu 2018 R&F by Andrew Kucharski
Promet Source
 
Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018
Promet Source
 
Migrating to-Drupal-8 by Bryan Manalo
Promet Source
 
Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018
Promet Source
 
Drupal Development with Docker
Promet Source
 
Web Accessibility in Drupal
Promet Source
 
Drupal Continuous Integration and devops - Beyond Jenkins
Promet Source
 
Drupal 8 Involvement with Promet Source
Promet Source
 
Using Commerce License for Premium Content on Drupal Sites
Promet Source
 
Behavioral driven development with Behat
Promet Source
 
Composer tools and frameworks for Drupal
Promet Source
 
Responsive Design Testing the Promet Way
Promet Source
 
Optimize and succeed your next Fixed Budget Project planning process
Promet Source
 
Diy continuous integration
Promet Source
 
Higher Ed Web 2013 presentation - Field of Dreams, build it and they will come
Promet Source
 
Getting agile with drupal
Promet Source
 
Project Estimation Presentation - Donte's 8th level of estimating level of ef...
Promet Source
 
DrupalCon 2013 Making Support Fun & Profitable
Promet Source
 
DevOps for Drupal: Why We Cook With Chef
Promet Source
 
Ad

Recently uploaded (20)

PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
Tally software_Introduction_Presentation
AditiBansal54083
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 

Migrating Drupal 7 to Drupal 8

  • 7. April 2018 D8 - 220K websites D7 - 900K websites D6 - 60K websites
  • 14. destination: plugin: entity:user /** * @MigrateDestination( * id = "entity:user" * ) */ class EntityUser extends EntityContentBase { protected function save(ContentEntityInterface $entity, array $old_destination_id_values = []) { $entity->save(); return [$entity->id()]; }
  • 16. roles: #roles are on a different table, but it is part of the user entity plugin: migration_lookup migration: d7_user_role source: roles
  • 17. roles: #roles are on a different table, but it is part of the user entity plugin: migration_lookup migration: d7_user_role source: roles
  • 18. # for nodes destination: plugin: 'entity:node' default_bundle: admissions_event # for user destination: plugin: 'entity:user'
  • 21. class User extends FieldableEntity { /** * {@inheritdoc} */ public function query() { return $this->select('users', 'u') ->fields('u') ->condition('u.uid', 0, '>'); }
  • 23. public function fields() { $fields = [ 'uid' => $this->t('User ID'), 'name' => $this->t('Username'), ]; return $fields; } User::fields are the source data you can use later in process section of the template.
  • 24. /** * Drupal 7 user source from database. * * @MigrateSource( * id = "d7_user", * source_module = "user" * ) */ class User extends FieldableEntity {
  • 25. being confident of this, that he who began a good work in you will carry it on to completion until the day of Christ Jesus.
  • 26. # mapping using the short notation (implicitly uses get process plugin) # destination:source process: uid: uid name: name pass: pass mail: mail
  • 27. # explicit mapping # <destination_field>: # plugin: <plugin_name> # source: <source_field> process: langcode: plugin: user_langcode source: language fallback_to_site_default: false roles: plugin: migration_lookup migration: d7_user_role source: roles
  • 28. user_picture: - plugin: default_value source: picture default_value: null - plugin: migration_lookup migration: d7_file
  • 29. /** * @MigrateProcessPlugin( * id = "migration_lookup_neiu_current_vid" * ) */ class NeiuCurrentVid extends Get { public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { $node = node_load($value); return $node->getRevisionId(); } }
  • 31. # syntax drush migrate-upgrade --configure-only --legacy-root=<website root> --legacy-db-key=<DB key> --migration-prefix=<Migration Prefix> Where: legacy-root is for example http://mywebsite.com legacy-db-key is your source d6/d7 db export defined in settings.php migration-prefix is any value that will be used as a prefix for the files generated for migration
  • 34. process: nid: tnid #remove this line vid: vid #remove this line uid: #migration_lookup is used to get the new uid from a previous user migration plugin: migration_lookup migration: hub_d7_user #the migration id of the previous user migration source: uid
  • 36. Freedom lies in being bold
  • 37. 1. Import the source database and define the connections in settings.php 2. Generate the migration template files using migrate_upgrade module: drush migrate-upgrade --configure-only --legacy-root=<website root> --legacy-db-key=<DB key> --migration-prefix=<Migration Prefix> 3. Export the migration template files using drush config-export: drush cex *** We need to export because it only exists in DB prior to this. Exporting will give the files to edit. 4. Edit/Delete the migration templates files into your config directory as needed. *** Ideally, you will just be migrating content, users and taxonomy. Configurations/content types can be manually created. 5. Reimport your changes using drush config-import: drush cim 6. Visit admin/structure/migrate and execute migrations (or rollback) as needed. Usually migrations are not as desired on the first run and edits to the custom plugin or template must be made. You can execute rollback and retry. If migration template changes are needed, step 5 must be executed for template changes to take effect.
  • 38. 1. Migrate Tools contrib module for using drush to execute migrations. 2. Migrate Manifest contrib to group migrations in a manifest file. 3. Using stubs for migrating chicken or egg scenarios.
  • 39. Go forth and multiply