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

PDF
Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...
PPTX
Ask Us Anything: Dries Buytaert and Team Tell All on Drupal 8
PDF
Drupal 8 Quick Start: An Overview of Lightning
PDF
Choosing Between Cross Platform of Native Development
ODP
Sakai spring maven archetype
PDF
Wireless Wednesdays: Beyond the Basics - Enhance your Enterprise Mobile Appli...
PPT
Drupal
PPT
Editing an app cloud 9
Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...
Ask Us Anything: Dries Buytaert and Team Tell All on Drupal 8
Drupal 8 Quick Start: An Overview of Lightning
Choosing Between Cross Platform of Native Development
Sakai spring maven archetype
Wireless Wednesdays: Beyond the Basics - Enhance your Enterprise Mobile Appli...
Drupal
Editing an app cloud 9

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

PPTX
Drupal 6 to Drupal 8 Migration
PDF
How to Migrate Drupal 6 to Drupal 8?
PPTX
Drupal migrations in 2018 - SFDUG, March 8, 2018
PDF
Drupal 8 update: May 2014. Migrate in core.
PDF
Tools to Upgrade to Drupal 8
PDF
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
PDF
Drupal Migrations in 2018
PDF
Upgrade Your Website From Drupal 7 to Drupal 8: A Step-by-Step Guideline
ODP
Conference Migrate to Drupal 8 by Leon Cros at Drupal Developer Days 2015 in ...
PDF
Drupal migrations in 2018 - presentation at DrupalCon in Nashville
PPTX
Migration to drupal 8.
PDF
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
PDF
Drupal 8 and Pantheon
PPT
PPPA D8 presentation Drupal For Gov_0
PPTX
Advantages of using drupal 8
PDF
[Srijan Wednesday Webinars] Breaking Limitations using Drupal 8
PPTX
Drupal 8 Initiatives
PPTX
UMD User's Group: DrupalCon 2011, Chicago
PDF
PDF
Choosing Drupal as your Content Management Framework
Drupal 6 to Drupal 8 Migration
How to Migrate Drupal 6 to Drupal 8?
Drupal migrations in 2018 - SFDUG, March 8, 2018
Drupal 8 update: May 2014. Migrate in core.
Tools to Upgrade to Drupal 8
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
Drupal Migrations in 2018
Upgrade Your Website From Drupal 7 to Drupal 8: A Step-by-Step Guideline
Conference Migrate to Drupal 8 by Leon Cros at Drupal Developer Days 2015 in ...
Drupal migrations in 2018 - presentation at DrupalCon in Nashville
Migration to drupal 8.
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
Drupal 8 and Pantheon
PPPA D8 presentation Drupal For Gov_0
Advantages of using drupal 8
[Srijan Wednesday Webinars] Breaking Limitations using Drupal 8
Drupal 8 Initiatives
UMD User's Group: DrupalCon 2011, Chicago
Choosing Drupal as your Content Management Framework
Ad

More from DrupalSib (20)

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

Recently uploaded (20)

PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPTX
international classification of diseases ICD-10 review PPT.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
Digital Literacy And Online Safety on internet
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
innovation process that make everything different.pptx
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PPTX
Introduction to Information and Communication Technology
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Design_with_Watersergyerge45hrbgre4top (1).ppt
presentation_pfe-universite-molay-seltan.pptx
international classification of diseases ICD-10 review PPT.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Digital Literacy And Online Safety on internet
introduction about ICD -10 & ICD-11 ppt.pptx
522797556-Unit-2-Temperature-measurement-1-1.pptx
SAP Ariba Sourcing PPT for learning material
Sims 4 Historia para lo sims 4 para jugar
innovation process that make everything different.pptx
Slides PPTX World Game (s) Eco Economic Epochs.pptx
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
An introduction to the IFRS (ISSB) Stndards.pdf
Decoding a Decade: 10 Years of Applied CTI Discipline
Introuction about ICD -10 and ICD-11 PPT.pptx
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Cloud-Scale Log Monitoring _ Datadog.pdf
Introduction to Information and Communication Technology
Slides PDF The World Game (s) Eco Economic Epochs.pdf

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