SlideShare a Scribd company logo
Migration from Drupal 6 to Drupal 8
My first Drupal 8 migration
Created by / Drupal developerIvan Abramenko CimpleO
ceservices.com
Drupal 8.0.x
Migrate Upgrade / Drupal Upgrade
https://www.drupal.org/project/migrate_upgrade
Drupal Upgrade - Drupal 8.1.x
Migrate Drupal UI - Drupal 8.2.x
Drupal 8.1.x migration
Migrate UI didn't work for Drupal 8.1.x and above
https://www.drupal.org/project/migrate_ui
Migrations are core are now plugins, not con g entities.
https://www.drupal.org/node/2677198
https://www.drupal.org/node/2625696
Try to use Migrate Drupal UI core module for Drupal 8.2.x
and above.
Drupal 8.2.x migration
Migrate Drupal UI in core!
Works, but not perfect.
Drupal 8.0.x migration
Drupal 8.0.x => Drupal 8.1.x => Drupal 8.2.x
Uninstall drupal migrate modules after migration and before
update to 8.1.x!
Why should use migrate module?
Migrate map
Import/Rollback
Stub content
Migrate import (drush support)
With Migrate Tools module
https://www.drupal.org/project/migrate_tools
drush migrate­import migration_name 
drush migrate­rollback migration_name 
          
Prepare migrations to import
            drush migrate­upgrade 
            ­­legacy­db­url=mysql://user:password@localhost:3306/db 
            ­­legacy­db­prefix=drup_ 
            ­­legacy­root=http://www.ceservices.com 
            ­­configure­only 
          
Drupal Upgrade module:
Drupal Upgrade
Successfully migrated:
User roles
Users
Node types (needed static map)
Failed with:
Nodes
Node types (needed static map)
blog_entry ­> blog_post
lp         ­> landing_page
2 ways to resolve it:
Add static map for migration .yml le
Add custom plugin
Process pipeline
Process pipeline
https://www.drupal.org/node/2129651
Plugins in Migrate UI:
static map
migration
explode
iterator
callback
concat
dedupe_entity
dedupebase
default_value
extract
atten
machine_name
skip_on_empty
skip_row_if_not_set
Custom plugins
/modules/ceservices_migrate/src/Plugin/migrate/process/CeservicesFieldsType.php
<?php 
/** 
* @file 
* Contains Drupalceservices_migratePluginmigrateprocessCeservicesFieldsType
*/ 
namespace Drupalceservices_migratePluginmigrateprocess; 
use DrupalmigrateProcessPluginBase; 
use DrupalmigrateMigrateExecutableInterface; 
use DrupalmigrateRow; 
/** 
* This plugin replaces old node_types with new. 
* 
* @MigrateProcessPlugin( 
*   id = "ceservices_fields_type" 
Custom plugins
/modules/ceservices_migrate/src/Plugin/migrate/process/CeservicesNodeTypes.php
<?php 
/** 
* @file 
* Contains Drupalceservices_migratePluginmigrateprocessCeservicesNodeTypes.
*/ 
namespace Drupalceservices_migratePluginmigrateprocess; 
use DrupalmigrateProcessPluginBase; 
use DrupalmigrateMigrateExecutableInterface; 
use DrupalmigrateRow; 
/** 
* This plugin replaces old node_types with new. 
* 
* @MigrateProcessPlugin( 
*   id = "ceservices_node_types" 
UI doesn't work as you want
https://www.drupal.org/node/2708967
UI doesn't work as you want
https://www.drupal.org/node/2708967
migrate.migration.d6_node_type.yml
... 
process: 
  type: 
    plugin: static_map 
    source: type 
    map: 
      blog_entry: blog 
...
Custom migrations are better than Migrate
Upgrade
Custom migrations
Nodes
Taxonomy
Nodewords, Page Title to Metatag
Nodes migration
YML- le for each content type:
/modules/ceservices_migrate/con g/install/
              
migrate.migration.ceservices_blog.yml 
migrate.migration.ceservices_book.yml 
migrate.migration.ceservices_page.yml 
migrate.migration.ceservices_story.yml 
... 
              
            
migrate.migration.ceservices_blog.yml:
id: ceservices_blog 
label: Blog nodes migration from Drupal 6 
dependencies: 
  enforced: 
    module: 
     ­ ceservices_migrate 
source: 
  plugin: ceservices_blog 
destination: 
  plugin: entity:node 
process: 
  nid: nid 
  vid: vid 
  type: type 
  langcode: 
    plugin: static_map 
    bypass: true 
Source => Destination
              
source: 
  plugin: ceservices_blog 
destination: 
  plugin: entity:node 
              
            
Source plugin
Custom plugin or d6_node?
Our choice is custom one. Extend DrupalSqlBase class, not
Node class for Drupal 6.
Blog source plugin
/modules/ceservices_migrate/src/Plugin/migrate/source/CeservicesBlog.php
<?php 
/** 
* @file 
* Contains Drupalceservices_migratePluginmigratesourceCeservicesBlog.
*/ 
namespace Drupalceservices_migratePluginmigratesource; 
use DrupalmigrateRow; 
use Drupalmigrate_drupalPluginmigratesourceDrupalSqlBase; 
/** 
* Drupal 6 Blog node source plugin 
* 
* @MigrateSource( 
*   id = "ceservices_blog" 
Why did we use DrupalSqlBase instead of
SourcePluginBase or SqlBase?
Blog source plugin's methods
query()
public function query() { 
  $query = $this­>select('node', 'n') 
    ­>condition('n.type', 'blog') 
    ­>fields('n'); 
  $query­>orderBy('nid'); 
  return $query; 
} 
fields()
public function fields() { 
  $fields = $this­>baseFields(); 
  $fields['body/format'] = $this­>t('Format of body'); 
  $fields['body/value'] = $this­>t('Full text of body'); 
  $fields['body/summary'] = $this­>t('Summary of body'); 
  $fields['field_related_testimonial'] = $this­>t('Related testimonial'); 
  $fields['field_related_resources'] = $this­>t('Related Resources'); 
  $fields['field_related_blog'] = $this­>t('Related Blog Posts'); 
  $fields['field_taxonomy'] = $this­>t('Taxonomy'); 
  return $fields; 
} 
            
prepareRow(Row $row)
public function prepareRow(Row $row) { 
  $nid = $row­>getSourceProperty('nid'); 
  // body (compound field with value, summary, and format) 
  $result = $this­>getDatabase()­>query(' 
    SELECT 
    * 
    FROM 
    {node_revisions} n 
    INNER JOIN {node} node ON n.vid = node.vid 
    LEFT JOIN {content_type_blog} t ON t.vid = n.vid 
    LEFT JOIN {content_field_related_testimonial} r ON r.vid = n.vid 
    WHERE 
    n.nid = :nid 
    LIMIT 0, 1 
    ', array(':nid' => $nid)); 
  foreach ($result as $record) { 
Single value fields:
$row­>setSourceProperty('body_value', $record­>body);
Multiple values fields:
// Multiple fields. 
$result = $this­>getDatabase()­>query(' 
  SELECT 
  * 
  FROM 
  {content_field_related_resources} r 
  INNER JOIN {node} node ON r.vid = node.vid 
  WHERE 
  r.nid = :nid 
  ', array(':nid' => $nid)); 
$related_resources = []; 
foreach ($result as $record) { 
  if (!empty($record­>field_related_resources_nid)) { 
    $related_resources[] = $record­>field_related_resources_nid; 
  } 
} 
$row­>setSourceProperty('field_related_resources', $related_resources); 
And few methods to describe entity:
public function getIds() { 
  $ids['nid']['type'] = 'integer'; 
  $ids['nid']['alias'] = 'n'; 
  return $ids; 
} 
public function bundleMigrationRequired() { 
  return FALSE; 
} 
public function entityTypeId() { 
  return 'node'; 
} 
            
Process — map between
destination => source
process: 
  nid: nid 
  vid: vid 
  type: type 
  langcode: 
    plugin: static_map 
    bypass: true 
    source: language 
    map: 
      und: en 
      en: en 
  title: title 
  uid: uid 
  status: status 
  created: created 
  changed: changed 
  promote: promote 
We decided to use old nid/vid values:
              
                process: 
                nid: nid 
                vid: vid 
              
            
Be sure you deleted all content before
migration!
Use batch API for any problems after
migration
Nodewords, Page Title:
https://www.drupal.org/node/2052441
https://www.drupal.org/node/2563649
Thank you! And successful migrations!
Migration from Drupal 6 to Drupal 8
My first Drupal 8 migration
Created by / Drupal developerIvan Abramenko CimpleO
levmyshkin89@gmail.com

More Related Content

Similar to Migrate drupal 6 to drupal 8. Абраменко Иван (20)

PPTX
Drupal 6 to Drupal 8 Migration
Ameex Technologies
 
PDF
How to Migrate Drupal 6 to Drupal 8?
DrupalGeeks
 
PPTX
Drupal migrations in 2018 - SFDUG, March 8, 2018
Irina Zaks
 
PDF
Drupal 8 update: May 2014. Migrate in core.
Vladimir Roudakov
 
PDF
Tools to Upgrade to Drupal 8
DrupalGeeks
 
PDF
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
Eric Sembrat
 
PDF
Drupal Migrations in 2018
Pantheon
 
PDF
Upgrade Your Website From Drupal 7 to Drupal 8: A Step-by-Step Guideline
Katy Slemon
 
ODP
Conference Migrate to Drupal 8 by Leon Cros at Drupal Developer Days 2015 in ...
Chipway
 
PDF
Drupal migrations in 2018 - presentation at DrupalCon in Nashville
Irina Zaks
 
PPTX
Migration to drupal 8.
Anatoliy Polyakov
 
PDF
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
Acquia
 
PDF
Drupal 8 and Pantheon
Pantheon
 
PPT
PPPA D8 presentation Drupal For Gov_0
Stan Ascher
 
PPTX
Advantages of using drupal 8
NeilWilson2015
 
PDF
[Srijan Wednesday Webinars] Breaking Limitations using Drupal 8
Srijan Technologies
 
PPTX
Drupal 8 Initiatives
Angela Byron
 
PPTX
UMD User's Group: DrupalCon 2011, Chicago
brockfanning
 
PDF
Drupal developers
eLuminous Technologies Pvt. Ltd.
 
PDF
Choosing Drupal as your Content Management Framework
Mediacurrent
 
Drupal 6 to Drupal 8 Migration
Ameex Technologies
 
How to Migrate Drupal 6 to Drupal 8?
DrupalGeeks
 
Drupal migrations in 2018 - SFDUG, March 8, 2018
Irina Zaks
 
Drupal 8 update: May 2014. Migrate in core.
Vladimir Roudakov
 
Tools to Upgrade to Drupal 8
DrupalGeeks
 
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
Eric Sembrat
 
Drupal Migrations in 2018
Pantheon
 
Upgrade Your Website From Drupal 7 to Drupal 8: A Step-by-Step Guideline
Katy Slemon
 
Conference Migrate to Drupal 8 by Leon Cros at Drupal Developer Days 2015 in ...
Chipway
 
Drupal migrations in 2018 - presentation at DrupalCon in Nashville
Irina Zaks
 
Migration to drupal 8.
Anatoliy Polyakov
 
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
Acquia
 
Drupal 8 and Pantheon
Pantheon
 
PPPA D8 presentation Drupal For Gov_0
Stan Ascher
 
Advantages of using drupal 8
NeilWilson2015
 
[Srijan Wednesday Webinars] Breaking Limitations using Drupal 8
Srijan Technologies
 
Drupal 8 Initiatives
Angela Byron
 
UMD User's Group: DrupalCon 2011, Chicago
brockfanning
 
Choosing Drupal as your Content Management Framework
Mediacurrent
 

More from DrupalSib (20)

PDF
SSO авторизация - Татьяна Киселева, DrupalJedi
DrupalSib
 
PDF
XML в крупных размерах - Михаил Крайнюк, DrupalJedi
DrupalSib
 
PPTX
BigPipe: ускоряем загрузку страниц - Давид Пашаев, DrupalJedi
DrupalSib
 
PDF
Drupal в школе - Борис Шрайнер
DrupalSib
 
PDF
Евгений Юдкин - Коммуникационные инструменты в отделе продаж на примере интег...
DrupalSib
 
PDF
D8 - Serialize, Normalize - Михаил Крайнюк, DrupalJedi
DrupalSib
 
PDF
Drupal - создание инсталляционных профайлов - Иван Абраменко, CimpleO
DrupalSib
 
PDF
Вадим Валуев - Искусство ИТ
DrupalSib
 
PDF
Андрей Юртаев - Mastering Views
DrupalSib
 
PDF
Entity возрождение легенды. Исай Руслан
DrupalSib
 
PDF
возводим динамическую таблицу, No views, no problem. Крайнюк Михаил
DrupalSib
 
PDF
Реализация “гибких” списков Жамбалова Намжилма
DrupalSib
 
PDF
Петр Селфин. Шок! Drupal 8 против SEO?! Без регистрации и SMS скачать бесплатно
DrupalSib
 
PDF
Сергей Синица. Разработка интернет-магазинов на Drupal
DrupalSib
 
PDF
Eugene Ilyin. Why Drupal is cool?
DrupalSib
 
PDF
Ivan Kotlyar. PostgreSQL in web applications
DrupalSib
 
PDF
Sergey Cherebedov. Deployment of the environment for Drupal using Ansible.
DrupalSib
 
PDF
Anton Shloma. Drupal as an integration platform
DrupalSib
 
PDF
Руслан Исай - Проповедуем Drupal разработку
DrupalSib
 
PDF
Сергей Черебедов - Integration Drupal with NodeJS. What is it and why You nee...
DrupalSib
 
SSO авторизация - Татьяна Киселева, DrupalJedi
DrupalSib
 
XML в крупных размерах - Михаил Крайнюк, DrupalJedi
DrupalSib
 
BigPipe: ускоряем загрузку страниц - Давид Пашаев, DrupalJedi
DrupalSib
 
Drupal в школе - Борис Шрайнер
DrupalSib
 
Евгений Юдкин - Коммуникационные инструменты в отделе продаж на примере интег...
DrupalSib
 
D8 - Serialize, Normalize - Михаил Крайнюк, DrupalJedi
DrupalSib
 
Drupal - создание инсталляционных профайлов - Иван Абраменко, CimpleO
DrupalSib
 
Вадим Валуев - Искусство ИТ
DrupalSib
 
Андрей Юртаев - Mastering Views
DrupalSib
 
Entity возрождение легенды. Исай Руслан
DrupalSib
 
возводим динамическую таблицу, No views, no problem. Крайнюк Михаил
DrupalSib
 
Реализация “гибких” списков Жамбалова Намжилма
DrupalSib
 
Петр Селфин. Шок! Drupal 8 против SEO?! Без регистрации и SMS скачать бесплатно
DrupalSib
 
Сергей Синица. Разработка интернет-магазинов на Drupal
DrupalSib
 
Eugene Ilyin. Why Drupal is cool?
DrupalSib
 
Ivan Kotlyar. PostgreSQL in web applications
DrupalSib
 
Sergey Cherebedov. Deployment of the environment for Drupal using Ansible.
DrupalSib
 
Anton Shloma. Drupal as an integration platform
DrupalSib
 
Руслан Исай - Проповедуем Drupal разработку
DrupalSib
 
Сергей Черебедов - Integration Drupal with NodeJS. What is it and why You nee...
DrupalSib
 
Ad

Recently uploaded (20)

PPTX
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
PPTX
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
PPTX
unit 2_2 copy right fdrgfdgfai and sm.pptx
nepmithibai2024
 
PPTX
internet básico presentacion es una red global
70965857
 
PPT
introductio to computers by arthur janry
RamananMuthukrishnan
 
PPTX
PM200.pptxghjgfhjghjghjghjghjghjghjghjghjghj
breadpaan921
 
PDF
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
PPT
Computer Securityyyyyyyy - Chapter 1.ppt
SolomonSB
 
PPTX
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
PPTX
Cost_of_Quality_Presentation_Software_Engineering.pptx
farispalayi
 
PPTX
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
PPT
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PDF
DevOps Design for different deployment options
henrymails
 
PPTX
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
PPTX
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PPTX
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PDF
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
unit 2_2 copy right fdrgfdgfai and sm.pptx
nepmithibai2024
 
internet básico presentacion es una red global
70965857
 
introductio to computers by arthur janry
RamananMuthukrishnan
 
PM200.pptxghjgfhjghjghjghjghjghjghjghjghjghj
breadpaan921
 
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
Computer Securityyyyyyyy - Chapter 1.ppt
SolomonSB
 
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
Cost_of_Quality_Presentation_Software_Engineering.pptx
farispalayi
 
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
DevOps Design for different deployment options
henrymails
 
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
Ad

Migrate drupal 6 to drupal 8. Абраменко Иван