Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Note: this information applies to the Drupal 8 migration system - it should be moved out of the documentation for the Drupal 7 migrate module.
This is an example of a customized mapping migration of Drupal 6 content to a new
Drupal 8 instance. The new Drupal 8 instance has its own bundles and field instances already built out.
Now that D6 is no longer supported, it was a must to move D6 sites I maintain to D7. This guide is the recipe to moving simple content with non-complicated CCK fields from D6 site to a D7 site.
Prepare your new site
Create all required content types on the new D7 site. Add all required fields to content types.
You can execute code before or after an import or rollback operation by implementing the Migration class methods preImport(), postImport(), preRollback(), or postRollback(). Each of these is called once per individual Migration - that is, if you implement preImport() in an article node migration class, it will be called after any previous migrations you're running, and immediately before the first row of your article node migration is called.
Typical actions can be the enabling / disabling of certain modules or changing configurations.
class ArticleMigration implements Migration {
...
public function preImport() {
parent::preImport();
// Code to execute before first article row is imported
}
...
public function postImport() {
parent::postImport();
// Code to execute after the last article row has been imported
}
...
public function preRollback() {
parent::preRollback();
// Code to execute before first article row is deleted
}
...
public function postRollback() {
parent::postRollback();
// Code to execute after the last article row has been deleted
}