SlideShare a Scribd company logo
1 of 29
Migrating Sites to DRUPAL
Piyuesh kumar
QED42
AGENDA
√ Old school migration strategies.
√ Migrate Module
√ Additional features of Migrate
√ Walk through migration from rails 3 to
Drupal7
√ Q&A
Old School Migration Strategies
√ Writing Migration(php) scripts.
√ Accuracy required.
√ Time consuming.
√ Not good when migrating large content.
√ x_export (node_export, user_export et al):
√ Easy to setup but requires exact mapping
√ No way to rollback
Migrate Module
√ Rollback functionality provides for iterative
development.
√ Simple and easy to understand migration
classes.
√ Drush support.
√ Extremely elaborate UI showing all the statistics.
√ Support for importing custom fields data.
How To Migrate
√ Identify you module to drupal using
“hook_migrate_api”.
√ Extend migration classes as per the requirement.
Example
Function mymodule_migrate_api {
return array(
‘api’ => 2
);
}
Extending Migration Class
√ Public function __construct()
√ Constructor for the migrate class.
√ Tells migrate about entity_type(node,taxonomy,users)
√ Source of the content(Databases, csv, xml)
√ Public function prepareRow()
√ Handles the post-processing of data imported.
√ Can also be used to add extra data to entities being
imported.
Example
class DemoMigration extends Migration {
public function __construct() {
/**
* Override the basic Migration class here.
*/
}
}
Example
class DemoMigration extends Migration {
public function prepareRow($current_row) {
/**
* Alter the data for the row being migrated here.
*/
}
}
Metadata required in constructor
√ Description : Text to tell what are we migrating.
√ Source_fields: Primary keys and any field that is not found in
the initial query.
√ Query: Query to fetch the data from legacy database.
√ Source: MigrateSourceSql instance to define the source of
migration.
√ Destination: MigrateDestination<entity_type> instance to
define the destination.
√ Map: Mapping to track the relationship between the source
rows from the source database and their resulting Drupal
objects.
√ Create one-on-one mapping between legacy db and drupal
objects (Using addFieldMapping).
Query
√ Query legacy database to fetch data to be
migrated.
√ Legacy db on Local
− Use db_select
√ Legacy db on remote server
− Database::getConnection();
MigrateSourceSql & Destination
√ MigrateSourceSql: Takes the query object
and source_fields as an argument and
defines the souce of data.
√ MigrateDestionation<entitytype>: Defines the
Destination drupal object type.
Example
√ $this->source = new
MigrateSourceSQL($query, $sourceFields);
√ $this->destination = new
MigrateDestinationNode('posts');
MigrateSqlMap
√ Responsible for creating mapping (source_id
+ destination_id).
√ Useful while creating relations between
imported drupal objects whose primary key
value has changed after migration.
Example
##User_legacy.inc
$this->map = new MigrateSQLMap($this->machineName,
array(
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => t('User id from old site'),
'alias' => 'u',
)
),
MigrateDestinationUser::getKeySchema()
);
##Content.inc
$this->addFieldMapping('uid', 'uid')
->sourceMigration(‘User_legacy')
Mapping fields
√ AddFieldMapping : Takes the source field
name and dest field name as arguments.
√ Options:
√ DefaultValue
√ SourceMigration
√ DNM
√ Arguments and seperators.
Example
√ $this->addFieldMapping('uid', 'user_id')
->sourceMigration('user')
->defaultValue(1);
√ $this->addFieldMapping('revision_uid')
->issueGroup(t('DNM'));
√ $this->addFieldMapping('body', 'body')
->arguments(MigrateTextFieldHandler::arguments(NULL,
'wysiwyg'));
Database Architecture
√ Migrate_map_<classname> : Stores the
mapping data.
√ Migrate_message_<classname> : Stores the
warnings or errors which come over while
migration.
√ Migrate_status: Stores the status for all
migration classes.
√ Migrate_log: Logs the migrations ran.
Processing data
√ Pre-processing: function prepareRow().
√ Post-processing: function complete()
e.g., D6 uses md5 encryption while d7 uses
sha512 for password. Logic for handling this
while migrating should go in here.
Example
public function complete($entity, stdClass $row) {
$pass = 'U'.$entity->pass;
$uid = $entity->uid;
db_update('users')
->fields(array(
'pass' => $pass,
))
->condition('uid', $uid)
->execute();
}
Additional features of migrate v2
√ Classes for varied import sources – Xml, JSON,
CSV, Databases
√ Allows to define own field handlers.
√ Allows migration of different entities: node,
taxonomy,users.
√ Drush integration makes it just awesome.
√ Rollback allows iterative migration easier i.e.,
you don't have to migrate all at once, migrate
one item, test, fix and repeat.
√ Highwater Mark
Highwater Mark
√ Allows to re-import newly added/modified
content in the legacy db.
√ How??
√ Field marked as highwater inside migration class
is saved by migrate when we import the data first
time.
√ Overtime more content gets added/modified to
the legacy db (for which this fields value is larger).
√ Next time we run import, migrate alters the source
query to fetch only those content which have the
value larger than highwater value saved by
migrate.
How to choose highwater field?
√ It should change everytime the content gets
modified.
√ It should have a greater value for a new
content added(compared to all the previous
nodes).
√ In case of drupal this can be the “changed”
property of nodes.
√ Make sure to order the data from legacy db
using this highwater field, so that last row
processed has the highest highwater value.
Example
√ Use of orderby clause in query.
$query->orderby(p.modified');
√ Define highwater field.
$this->highwaterField = array(
'name' => ’modified',
'alias' => ‘p'
);
Drush Commands
√ Drush ms: lists all migration classes
√ Drush mi <classname>: Import content
√ Drush mr <classname>: rollback content
√ Options:
√ Idlist: allows migration of content with specific ids.
√ limit: allows to migrate n no of items.
√ Feedback = n seconds/items :status of migration
after n items or seconds.
Modules based on Migrate
√ Ubercart_migrate
√ Migrate_d2d
√ Wordpress_migrate
√ TYPO3_migrate
√ phpbb2drupal
Putting it all together
Demo
Sources
√ https://github.com/qed42/rdm-drupal
√ https://github.com/piyuesh23/joomla_drupal
√ https://github.com/qed42/rdm-rails
Thank You!!
Questions?

More Related Content

What's hot

Dive into Catalyst
Dive into CatalystDive into Catalyst
Dive into CatalystCheng Lian
 
Manipulating Data using DPLYR in R Studio
Manipulating Data using DPLYR in R StudioManipulating Data using DPLYR in R Studio
Manipulating Data using DPLYR in R StudioRupak Roy
 
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...CloudxLab
 
Introduction to Hadoop and MapReduce
Introduction to Hadoop and MapReduceIntroduction to Hadoop and MapReduce
Introduction to Hadoop and MapReduceDr Ganesh Iyer
 
Mapreduce Algorithms
Mapreduce AlgorithmsMapreduce Algorithms
Mapreduce AlgorithmsAmund Tveit
 
Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...
Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...
Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...Accumulo Summit
 
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...Spark Summit
 
Using Spark to Load Oracle Data into Cassandra
Using Spark to Load Oracle Data into CassandraUsing Spark to Load Oracle Data into Cassandra
Using Spark to Load Oracle Data into CassandraJim Hatcher
 
DMS (Database Migration Service) - Mydbops Team
DMS  (Database Migration Service) - Mydbops TeamDMS  (Database Migration Service) - Mydbops Team
DMS (Database Migration Service) - Mydbops TeamMydbops
 
Large volume data analysis on the Typesafe Reactive Platform - Big Data Scala...
Large volume data analysis on the Typesafe Reactive Platform - Big Data Scala...Large volume data analysis on the Typesafe Reactive Platform - Big Data Scala...
Large volume data analysis on the Typesafe Reactive Platform - Big Data Scala...Martin Zapletal
 
Study Notes: Apache Spark
Study Notes: Apache SparkStudy Notes: Apache Spark
Study Notes: Apache SparkGao Yunzhong
 
Apache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLab
Apache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLabApache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLab
Apache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLabCloudxLab
 
Large volume data analysis on the Typesafe Reactive Platform
Large volume data analysis on the Typesafe Reactive PlatformLarge volume data analysis on the Typesafe Reactive Platform
Large volume data analysis on the Typesafe Reactive PlatformMartin Zapletal
 
Hadoop & MapReduce
Hadoop & MapReduceHadoop & MapReduce
Hadoop & MapReduceNewvewm
 

What's hot (20)

Dive into Catalyst
Dive into CatalystDive into Catalyst
Dive into Catalyst
 
Cloud jpl
Cloud jplCloud jpl
Cloud jpl
 
Manipulating Data using DPLYR in R Studio
Manipulating Data using DPLYR in R StudioManipulating Data using DPLYR in R Studio
Manipulating Data using DPLYR in R Studio
 
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
 
Introduction to Hadoop and MapReduce
Introduction to Hadoop and MapReduceIntroduction to Hadoop and MapReduce
Introduction to Hadoop and MapReduce
 
Cassandra+Hadoop
Cassandra+HadoopCassandra+Hadoop
Cassandra+Hadoop
 
Mapreduce Algorithms
Mapreduce AlgorithmsMapreduce Algorithms
Mapreduce Algorithms
 
Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...
Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...
Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...
 
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...
A Scalable Hierarchical Clustering Algorithm Using Spark: Spark Summit East t...
 
Using Spark to Load Oracle Data into Cassandra
Using Spark to Load Oracle Data into CassandraUsing Spark to Load Oracle Data into Cassandra
Using Spark to Load Oracle Data into Cassandra
 
DMS (Database Migration Service) - Mydbops Team
DMS  (Database Migration Service) - Mydbops TeamDMS  (Database Migration Service) - Mydbops Team
DMS (Database Migration Service) - Mydbops Team
 
Large volume data analysis on the Typesafe Reactive Platform - Big Data Scala...
Large volume data analysis on the Typesafe Reactive Platform - Big Data Scala...Large volume data analysis on the Typesafe Reactive Platform - Big Data Scala...
Large volume data analysis on the Typesafe Reactive Platform - Big Data Scala...
 
Study Notes: Apache Spark
Study Notes: Apache SparkStudy Notes: Apache Spark
Study Notes: Apache Spark
 
Apache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLab
Apache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLabApache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLab
Apache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLab
 
9.4json
9.4json9.4json
9.4json
 
Large volume data analysis on the Typesafe Reactive Platform
Large volume data analysis on the Typesafe Reactive PlatformLarge volume data analysis on the Typesafe Reactive Platform
Large volume data analysis on the Typesafe Reactive Platform
 
Map Reduce Online
Map Reduce OnlineMap Reduce Online
Map Reduce Online
 
RTree Spatial Indexing with MongoDB - MongoDC
RTree Spatial Indexing with MongoDB - MongoDC RTree Spatial Indexing with MongoDB - MongoDC
RTree Spatial Indexing with MongoDB - MongoDC
 
Hadoop & MapReduce
Hadoop & MapReduceHadoop & MapReduce
Hadoop & MapReduce
 
Php dba cache
Php dba cachePhp dba cache
Php dba cache
 

Similar to Dcm migration

Migrating data into Drupal using the migrate module
Migrating data into Drupal using the migrate moduleMigrating data into Drupal using the migrate module
Migrating data into Drupal using the migrate moduleJohan Gant
 
Automating Drupal Migrations
Automating Drupal MigrationsAutomating Drupal Migrations
Automating Drupal MigrationslittleMAS
 
Data migration to Drupal using Migrate Module
Data migration to Drupal using Migrate ModuleData migration to Drupal using Migrate Module
Data migration to Drupal using Migrate ModuleSrijan Technologies
 
mongodb-aggregation-may-2012
mongodb-aggregation-may-2012mongodb-aggregation-may-2012
mongodb-aggregation-may-2012Chris Westin
 
Making sense of the Graph Revolution
Making sense of the Graph RevolutionMaking sense of the Graph Revolution
Making sense of the Graph RevolutionInfiniteGraph
 
Advanced moduledevelopment d6_slideshare
Advanced moduledevelopment d6_slideshareAdvanced moduledevelopment d6_slideshare
Advanced moduledevelopment d6_slideshareOpevel
 
Tez Data Processing over Yarn
Tez Data Processing over YarnTez Data Processing over Yarn
Tez Data Processing over YarnInMobi Technology
 
Core Data Migrations and A Better Option
Core Data Migrations and A Better OptionCore Data Migrations and A Better Option
Core Data Migrations and A Better OptionPriya Rajagopal
 
Drupal II: The SQL
Drupal II: The SQLDrupal II: The SQL
Drupal II: The SQLddiers
 
Hive Anatomy
Hive AnatomyHive Anatomy
Hive Anatomynzhang
 
Move Into Drupal Using The Migrate Module
Move Into Drupal Using The Migrate ModuleMove Into Drupal Using The Migrate Module
Move Into Drupal Using The Migrate Modulenyccamp
 
Migrating to Drupal 8
Migrating to Drupal 8Migrating to Drupal 8
Migrating to Drupal 8Alkuvoima
 
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UKIntroduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UKSkills Matter
 
Apache Spark Introduction - CloudxLab
Apache Spark Introduction - CloudxLabApache Spark Introduction - CloudxLab
Apache Spark Introduction - CloudxLabAbhinav Singh
 

Similar to Dcm migration (20)

Migrating data into Drupal using the migrate module
Migrating data into Drupal using the migrate moduleMigrating data into Drupal using the migrate module
Migrating data into Drupal using the migrate module
 
Automating Drupal Migrations
Automating Drupal MigrationsAutomating Drupal Migrations
Automating Drupal Migrations
 
Migrate
MigrateMigrate
Migrate
 
Data migration to Drupal using Migrate Module
Data migration to Drupal using Migrate ModuleData migration to Drupal using Migrate Module
Data migration to Drupal using Migrate Module
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
 
mongodb-aggregation-may-2012
mongodb-aggregation-may-2012mongodb-aggregation-may-2012
mongodb-aggregation-may-2012
 
Making sense of the Graph Revolution
Making sense of the Graph RevolutionMaking sense of the Graph Revolution
Making sense of the Graph Revolution
 
Advanced moduledevelopment d6_slideshare
Advanced moduledevelopment d6_slideshareAdvanced moduledevelopment d6_slideshare
Advanced moduledevelopment d6_slideshare
 
Hadoop ecosystem
Hadoop ecosystemHadoop ecosystem
Hadoop ecosystem
 
Tez Data Processing over Yarn
Tez Data Processing over YarnTez Data Processing over Yarn
Tez Data Processing over Yarn
 
Core Data Migrations and A Better Option
Core Data Migrations and A Better OptionCore Data Migrations and A Better Option
Core Data Migrations and A Better Option
 
Drupal II: The SQL
Drupal II: The SQLDrupal II: The SQL
Drupal II: The SQL
 
Hadoop ecosystem
Hadoop ecosystemHadoop ecosystem
Hadoop ecosystem
 
Hive Anatomy
Hive AnatomyHive Anatomy
Hive Anatomy
 
Move Into Drupal Using The Migrate Module
Move Into Drupal Using The Migrate ModuleMove Into Drupal Using The Migrate Module
Move Into Drupal Using The Migrate Module
 
Einführung in MongoDB
Einführung in MongoDBEinführung in MongoDB
Einführung in MongoDB
 
Migrate to Drupal 8
Migrate to Drupal 8Migrate to Drupal 8
Migrate to Drupal 8
 
Migrating to Drupal 8
Migrating to Drupal 8Migrating to Drupal 8
Migrating to Drupal 8
 
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UKIntroduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
 
Apache Spark Introduction - CloudxLab
Apache Spark Introduction - CloudxLabApache Spark Introduction - CloudxLab
Apache Spark Introduction - CloudxLab
 

More from Piyuesh Kumar

More from Piyuesh Kumar (6)

Drupal 8 Cache: Under the hood
Drupal 8 Cache: Under the hoodDrupal 8 Cache: Under the hood
Drupal 8 Cache: Under the hood
 
Dcp'14 drush
Dcp'14 drushDcp'14 drush
Dcp'14 drush
 
Dcp'15
Dcp'15Dcp'15
Dcp'15
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
Future Proofing Your Drupal Skills
Future Proofing Your Drupal SkillsFuture Proofing Your Drupal Skills
Future Proofing Your Drupal Skills
 
Into to drupal8
Into to drupal8Into to drupal8
Into to drupal8
 

Recently uploaded

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Recently uploaded (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Dcm migration

  • 1. Migrating Sites to DRUPAL Piyuesh kumar QED42
  • 2. AGENDA √ Old school migration strategies. √ Migrate Module √ Additional features of Migrate √ Walk through migration from rails 3 to Drupal7 √ Q&A
  • 3. Old School Migration Strategies √ Writing Migration(php) scripts. √ Accuracy required. √ Time consuming. √ Not good when migrating large content. √ x_export (node_export, user_export et al): √ Easy to setup but requires exact mapping √ No way to rollback
  • 4. Migrate Module √ Rollback functionality provides for iterative development. √ Simple and easy to understand migration classes. √ Drush support. √ Extremely elaborate UI showing all the statistics. √ Support for importing custom fields data.
  • 5. How To Migrate √ Identify you module to drupal using “hook_migrate_api”. √ Extend migration classes as per the requirement.
  • 7. Extending Migration Class √ Public function __construct() √ Constructor for the migrate class. √ Tells migrate about entity_type(node,taxonomy,users) √ Source of the content(Databases, csv, xml) √ Public function prepareRow() √ Handles the post-processing of data imported. √ Can also be used to add extra data to entities being imported.
  • 8. Example class DemoMigration extends Migration { public function __construct() { /** * Override the basic Migration class here. */ } }
  • 9. Example class DemoMigration extends Migration { public function prepareRow($current_row) { /** * Alter the data for the row being migrated here. */ } }
  • 10. Metadata required in constructor √ Description : Text to tell what are we migrating. √ Source_fields: Primary keys and any field that is not found in the initial query. √ Query: Query to fetch the data from legacy database. √ Source: MigrateSourceSql instance to define the source of migration. √ Destination: MigrateDestination<entity_type> instance to define the destination. √ Map: Mapping to track the relationship between the source rows from the source database and their resulting Drupal objects. √ Create one-on-one mapping between legacy db and drupal objects (Using addFieldMapping).
  • 11. Query √ Query legacy database to fetch data to be migrated. √ Legacy db on Local − Use db_select √ Legacy db on remote server − Database::getConnection();
  • 12. MigrateSourceSql & Destination √ MigrateSourceSql: Takes the query object and source_fields as an argument and defines the souce of data. √ MigrateDestionation<entitytype>: Defines the Destination drupal object type.
  • 13. Example √ $this->source = new MigrateSourceSQL($query, $sourceFields); √ $this->destination = new MigrateDestinationNode('posts');
  • 14. MigrateSqlMap √ Responsible for creating mapping (source_id + destination_id). √ Useful while creating relations between imported drupal objects whose primary key value has changed after migration.
  • 15. Example ##User_legacy.inc $this->map = new MigrateSQLMap($this->machineName, array( 'uid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'description' => t('User id from old site'), 'alias' => 'u', ) ), MigrateDestinationUser::getKeySchema() ); ##Content.inc $this->addFieldMapping('uid', 'uid') ->sourceMigration(‘User_legacy')
  • 16. Mapping fields √ AddFieldMapping : Takes the source field name and dest field name as arguments. √ Options: √ DefaultValue √ SourceMigration √ DNM √ Arguments and seperators.
  • 17. Example √ $this->addFieldMapping('uid', 'user_id') ->sourceMigration('user') ->defaultValue(1); √ $this->addFieldMapping('revision_uid') ->issueGroup(t('DNM')); √ $this->addFieldMapping('body', 'body') ->arguments(MigrateTextFieldHandler::arguments(NULL, 'wysiwyg'));
  • 18. Database Architecture √ Migrate_map_<classname> : Stores the mapping data. √ Migrate_message_<classname> : Stores the warnings or errors which come over while migration. √ Migrate_status: Stores the status for all migration classes. √ Migrate_log: Logs the migrations ran.
  • 19. Processing data √ Pre-processing: function prepareRow(). √ Post-processing: function complete() e.g., D6 uses md5 encryption while d7 uses sha512 for password. Logic for handling this while migrating should go in here.
  • 20. Example public function complete($entity, stdClass $row) { $pass = 'U'.$entity->pass; $uid = $entity->uid; db_update('users') ->fields(array( 'pass' => $pass, )) ->condition('uid', $uid) ->execute(); }
  • 21. Additional features of migrate v2 √ Classes for varied import sources – Xml, JSON, CSV, Databases √ Allows to define own field handlers. √ Allows migration of different entities: node, taxonomy,users. √ Drush integration makes it just awesome. √ Rollback allows iterative migration easier i.e., you don't have to migrate all at once, migrate one item, test, fix and repeat. √ Highwater Mark
  • 22. Highwater Mark √ Allows to re-import newly added/modified content in the legacy db. √ How?? √ Field marked as highwater inside migration class is saved by migrate when we import the data first time. √ Overtime more content gets added/modified to the legacy db (for which this fields value is larger). √ Next time we run import, migrate alters the source query to fetch only those content which have the value larger than highwater value saved by migrate.
  • 23. How to choose highwater field? √ It should change everytime the content gets modified. √ It should have a greater value for a new content added(compared to all the previous nodes). √ In case of drupal this can be the “changed” property of nodes. √ Make sure to order the data from legacy db using this highwater field, so that last row processed has the highest highwater value.
  • 24. Example √ Use of orderby clause in query. $query->orderby(p.modified'); √ Define highwater field. $this->highwaterField = array( 'name' => ’modified', 'alias' => ‘p' );
  • 25. Drush Commands √ Drush ms: lists all migration classes √ Drush mi <classname>: Import content √ Drush mr <classname>: rollback content √ Options: √ Idlist: allows migration of content with specific ids. √ limit: allows to migrate n no of items. √ Feedback = n seconds/items :status of migration after n items or seconds.
  • 26. Modules based on Migrate √ Ubercart_migrate √ Migrate_d2d √ Wordpress_migrate √ TYPO3_migrate √ phpbb2drupal
  • 27. Putting it all together Demo