There's no way to preserve book hierarchies from one Drupal instance to the other. I could use some advice on that or if it's not implemented I would appreciate a feature to do so.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mmcintosh’s picture

I recently encountered this issue in multi-step migration upgrade of a drupal 6 to 7 project and I found that the best tool for the job was the Node Export Module also the UUID Module was needed.

I removed most of the other modules and did an in place upgrade to Drupal 7 then exported the books to a clean new drupal 7 instance and all the hierarchies remained intact.

Hope this helps.

CWSmith1701’s picture

I don't disagree with this, however with Drupal 8 giving up the direct upgrade method in favor of migrate module this becomes even more important if you ask me. You need to be able to pull your content over without issues, including hierarchies and the like.

CWSmith1701’s picture

I'm looking at the DB, and while I have no idea HOW to code this I would think using the information available at https://drupal.org/node/1513766 might be helpful. I honestly just don't have the coding ability to do it.

Hence why I ask support for books be in the UI here.

AndyF’s picture

Component: User interface » Code
Issue summary: View changes
Status: Active » Needs review
FileSize
5.62 KB

Hi,

I've made a menu migration class that reads from a D6 source and works with the D7 menu destination handler posted in #763880: Import Hierarchy as Book. The migration is based on a menu link migration, and should be run after all the book nodes have been imported. Here's an example that works if the book content types are page, story and book. Thanks.

/**
 * Implements hook_migrate_api().
 */
function bookmigrate_migrate_api() {
  $common_arguments = array(
    'source_connection' => 'legacy',
    'source_version' => 6,
    'group_name' => 'book',
  );

  return array(
    'api' => 2,
    'groups' => array(
      'book' => array(
        'title' => t("Test book migrations"),
      ),
    ),
    'migrations' => array(
      'BookMigrateUser' => $common_arguments + array(
        'class_name' => 'DrupalUser6Migration',
        'description' => t("Migration of users from Drupal 6"),
      ),
      'BookMigrateBook' => $common_arguments + array(
        'class_name' => 'DrupalNode6Migration',
        'description' => t("Migration of book nodes from Drupal 6"),
        'source_type' => 'book',
        'destination_type' => 'book',
        'user_migration' => 'BookMigrateUser',
      ),
      'BookMigrateStory' => $common_arguments + array(
        'class_name' => 'DrupalNode6Migration',
        'description' => t("Migration of story nodes from Drupal 6"),
        'source_type' => 'story',
        'destination_type' => 'article',
        'user_migration' => 'BookMigrateUser',
      ),
      'BookMigratePage' => $common_arguments + array(
        'class_name' => 'DrupalNode6Migration',
        'description' => t("Migration of page nodes from Drupal 6"),
        'source_type' => 'page',
        'destination_type' => 'page',
        'user_migration' => 'BookMigrateUser',
      ),
      'BookMigrateOutline' => $common_arguments + array(
        'class_name' => 'DrupalBookLinks6Migration',
        'description' => t("Migration of book outlines from Drupal 6"),
        'group_name' => 'book',
        'node_migrations' => array(
          'BookMigrateBook',
          'BookMigratePage',
          'BookMigrateStory',
        ),
      ),
    ),
  );
}

pip0’s picture

A simple method to import all my book hierarchy is :
1 - Dump the "menu_links" table from drupal 6 by selecting only links used by my book pages
2 - Add two columns "language" and "i18n_tsid" at the end of each row from the dumping Drupal 6 "menu_links" table with there value.
3 - Import the updated "menu_links" table from Drupal 6 to Drupal 7

Example "menu_links" table row to import with Drupal 7:
INSERT IGNORE INTO `menu_links` (`menu_name`, `mlid`, `plid`, `link_path`, `router_path`, `link_title`, `options`, `module`, `hidden`, `external`, `has_children`, `expanded`, `weight`, `depth`, `customized`, `p1`, `p2`, `p3`, `p4`, `p5`, `p6`, `p7`, `p8`, `p9`, `updated`, `language`, `i18n_tsid`) VALUES ('book-toc-200', 1320, 0, 'node/200', 'node/%', 'Services', 'a:0:{}', 'book', 0, 0, 1, 0, 0, 1, 0, 1320, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'und', 0);

Hope that this can help some one else.

pierregermain’s picture

I have left at https://www.drupal.org/node/1513766#comment-13273005 an example how to migrate the links from D6 to D8