0

I have a D6 installation with a very large content type (i.e. a lot of fields) called field_data. I need to migrate the field_data nodes out of D6 and into a new D7 instance. This D7 instance has two content types called field_data and accomplishments. The accomplishments content type has a field that is a node reference to the appropriate node of the field_data type. Essentially I am exporting one content type and need to import each node as two nodes that reference each other. I have looked into the feeds module and don't see a way to do this. What is the best way to do this?

0

This will not be simple, as it is a requirement which is probably unique to your site. I know of no modules designed for this scenario. In general terms, you need to do the following.

  1. Import the field_data content WITH all the fields into your D7 field_data type.

  2. Create your accomplishments content type, and clone each field_data type to an instance of the accomplishments type, recording the nid of the source instance (field_data). Look at the Node Clone module to see how it is done. (Note: This module will not do this out of the box. You will have to hack it to do what you want.) You can probably use hook_node_presave to change the bundle and move the nid to the term reference field, then blank $node->nid to create a new node. Using Feeds or Backup and Migrate will not give you the nid for the node reference.

  3. Delete the unwanted fields from the D7 field_data type.

You might also be able to accomplish this through direct manipulation of the database, but it is probably best to do it 'the drupal way' to avoid any artifacts which you might introduce in the direct query method.

Good luck.

0

The migrate module can do it. It is however quite tricky to use. Start by reading the basics of the documentation

This page: http://drupal.org/node/1513766 covers the migration of books. But is quite a good start for any kind of node.

You will need to expand the node_query() function with leftJoins to all the d6 fields. (Look them up in your database, you can join them by nid.) Because of the joins you can make the input field list as big as you want.

Then in the map (node_field_mapping() function) you can add all fields of your new type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.