Posts

Showing posts with the label d6-d8 migration

XML-D8 Migration: Very basic migration by just using YML file

Image
As we are working XML to Drupal 8 migration project, so we just want to explore how the very basic migration looks like! We have written a custom module to define mapping between XML data and Drupal 8 entity. Like any other module in D8, we need .info.yml file which looks like below, In the .info.yml file, we have added dependencies for migrate_plus and migrate_tools modules. Migrate Plus module is required to do migration from sources like XML and JSON. Migrate Tools module provides tools for running and managing Drupal 8 migrations. As we are migration from XML so we have created a sample XML file which contains ID, Title and Body fields. It looks like below, Lastly and most importantly, for this very basic migration, we just needed one .yml file in config/install folder for our migration. This .yml file defines Source (XML file and fields in it), Destination (Drupal entity) and Field mappings (Process plugins). It looks like below, We have placed the source XM...

D6-D8 migration: How did we find missing migrations?

Image
We were working on D6 to D8 migration projects where we were migrating the revised database of D6 site to D8 site every other month. We started with full migration initially and then with partial migration subsequently. This was working perfectly fine. We were using drush commands to do the migration. But recently when we got the latest D6 database, we were no longer seeing term node migration entities (d6_term_node__1, d6_term_node__2 etc.) with drush migrate-status command in D8. Although migration worked fine for all other items but as we were not seeing term node relationship entities (d6_term_node__1) so latest migrated content doesn't had terms associated with it. We tried switching to old D6 database but that didn't help. We tried using --configure-only option with drush command to regenerate the migrations but even that didn't help, drush migrate-upgrade --configure-only --legacy-db-url=mysql://drupaluser:@127.0.0.1:33067/d6 --legacy-root=http://d6.local:8...

D6-D8 migration: How did we skip certain content types from migration?

Image
In one of our projects, there were 10-12 content types in D6 site but some of them were not being used anymore. So we had to skip them during migration. We wanted to skip those unwanted content types, their fields and content in those content types. One option is generate the migrations using --configure-only option in migrate-upgrade drush command. Then export the generated migrations on file system. Afterwards we can remove the unwanted yml files for those unwanted content types and remove their dependencies, if any, from other content types in their yml files. This will help in skipping the migrations of certain content types. We can also make changes in the yml files as per our requirement like mapping of new fields with old field, process plugins for certain fields etc. We used another approach. We used hook_migrate_prepare_row() in our custom module to skip the certain migrations. Following code helped us to skip the migrations of certain content types, their fields and da...

D6-D8 migration: How did we migrate Drupal 6 Nodewords: D6 Meta Tags (nodewords module) to Drupal 8 Metatag

Image
In Drupal 6, we use Nodewords: D6 Meta Tags module to have meta tags attached to Content. Currently Drupal 8 Metatag module doesn't support migration of meta tags from Drupal 6 content to Drupal 8 content. We used following steps to migrate the meta tags from D6 to D8 site: 1) Firstly we setup the D6 site by enabling contributed Nodewords module along with it's sub module Nodewords basic meta tags. These two modules provided support for adding meta tags information in all the available content types. Our D6 site looks like below after we added content in Page content type along with meta tags information, 2) Next we setup D8 site and enabled Metatag module. drush en metatag -y We added Metatag field (field_metatag) of field type 'Meta tags' in Page content type so that we can migrate D6 metatag information in Page content type to this field. You have to add 'Meta tags' type field in the content types if you want to associate meta tags informa...

D6-D8 migration: Migration of Drupal 6 Images (Image module) to Drupal 8 Images

Image
As per D6-D8 migration: Migration of Drupal 6 Images (ImageField module) to Drupal 8 Images works out of the Box! , we tried to migrate images from D6 site, which is using Image module, but the images didn't get migrated. So images uploaded using Image module along with it's sub module image_attach in D6 content type don't migrate out of the box. We used following steps to migrate the Images from D6 to D8 site: 1) Firstly we setup the D6 site by enabling contributed Image module along with it's sub module image_attach. And then we enabled images support for Page content type like below, 2) Next we added the content in page content type with multiple images in D6 site. Our D6 site looks like below, 3) Next we setup D8 site and added Image field (field_page_image) in Page content type. We enabled Drupal Upgrade and Migrate Tools contrib modules for the migration, drush en migrate_upgrade migrate_tools -y 4) This was optional step. We specified $con...

D6-D8 migration: Migration of Drupal 6 Images (ImageField module) to Drupal 8 Images works out of the Box!

Image
We are having a Drupal 6 site, which is using ImageField module, for adding images in content type. The content and images migration to Drupal 8 site works out of the box!! We carried out following steps to see it in action: 1) In D6 site, we added Image field, as provided by ImageField module, in Page content type. We configured this field to have Alt/Title information along with Unlimited number of values. After adding the field, we created a Page content and uploaded multiple images in Image field along with Alt/Title info. D6 site with Page content looks like below, 2) Next we installed D8 site with default settings. Afterwards we enabled Drupal Upgrade and Migrate Tools contrib modules to do the migration, drush en migrate_upgrade migrate_tools -y 3) Then we executed the migration using Drush. Either we can run the full migration like below, drush migrate-import --all OR we can execute specific migrations for content and images like below, drush migrate-impo...

D6-D8 migration: How did we migrate Drupal 6 Body field to Drupal 8 Paragraph Type Text?

Image
We are working on Drupal 6 to Drupal 8 site migration. One of the requirement was to migrate a Body field of Page content type to Paragraph Type Text field in Page content type. We have used Paragraphs module to setup Paragraph Type Text field in Page content type. Here is a step by step instructions to do the migration: 1) Firstly we enabled following contributed modules, drush en migrate_upgrade migrate_tools -y drush en paragraphs entity_reference_revisions -y 2) We setup the Text Paragraphs type at /admin/structure/paragraphs_type/ and added one Textarea field at /admin/structure/types/manage/page/fields. 3) We added the Paragraph type text field in Page content type, 4) This was optional step. We specified $config_directories variable in settings.php, $config_directories['sync'] = 'config'; 5) To generate the migrations for our site, we passed --configure-only option to migrate-upgrade drush command. As it indicates, our D6 site is host...