Watching:

Migrating custom fields from Drupal 6


show more Migrating custom fields from Drupal 6 provides you with in-depth training on Developer. Taught by Tom Geller as part of the Drupal 7: Reporting and Visualizing Data show less
please wait ...

Migrating custom fields from Drupal 6

I'm going to guess that some of you watching this course already have experience with Drupal 6. Maybe you have a Drupal 6 site already built, and you want to see how to move it from the old data storage model to Drupal 7's new one. If so, this video is for you. It'll be quite different from all the others in this course, because we'll start off with the same employee database we've been seeing, but this time in a Drupal 6 site. I'll then show you what it looks like after a standard upgrade to Drupal 7, but you'll notice that none of our custom fields appear. But don't worry; we'll finally do some special procedures to bring everything up to date.

There are no exercise files for this video, because you'd have to go through quite a lot of trouble to follow along at home. But it should be clear just from watching. First, here's our Drupal 6 site and you'll notice it looks sort of familiar. When you click on a title, we get the data for any one of our employees and so forth. We've simplified it a little bit by adding only a few fields. Now here's the Drupal 7 equivalent. But if you click on one of these titles, you'll see that actually there are no other fields, it's only the title. Don't worry; we'll be exposing all the other data.

It did come over in the migration, but it's just not showing up yet, because there's different data storage models between Drupal 6 and Drupal 7. Incidentally, the way that I brought this over was I simply created a brand-new copy of Drupal 7 and then imported the Drupal 6 database. Then I ran Drupal's update.php script. In order to bring it up to date, we're going to go up to Structure, and Content types. Then we'll take a look at our Employee Content type and manage fields. And indeed we don't have any of the fields that we expect.

We have only the title, none of the custom ones that we created. In order to convert it over, we'll look at some instructions that I found on drupal.org. The location is drupal.org/ node/1144136. And there it is. The important part of this page is this Upgrade Steps. And the most crucial part of that is that you need a certain module, the CCK module. You might remember that that's how we actually got those custom fields into Drupal 6. Well, in order to do the migration, you also need it in Drupal 7. So we'll go to it.

It's at drupal.org/project/cck. I'll Ctrl+Click to open that in a new tab. I scroll down, and as usual, I download the latest version. Notice that for Drupal 7 there's only a Development release. Well, you take what you can get, so I'll take the .gz file, copy its link location, go back to my site, and install it in the usual way. Click Modules, Install new module, paste, and Install, and then enable the correct parts of the module.

As we scroll down on the page, we see a CCK group. It includes CCK, but also this thing, Content Migrate. That's the part that will help us, and Save configuration. The next thing to do is to go to Structure and Migrate fields. We want to migrate all of our fields, so I'll all click this check box at the top, and then click Migrate selected fields. This may take a while.

Now if we go back up to our Content type by clicking Structure, Content types, and manage fields next to Employee, we see that our fields are there. If we go back to the front page of our site and we click on any one of these, we're all good once again. So those are the basic steps. There are several special cases you need to know if you're converting a complex Drupal 6 site. For example, you'll need extra modules to migrate reference fields, field-based content permissions, or field groups. The details once again are on this page on drupal.org, at drupal.org/node/1144136.

Migrating custom fields from Drupal 6
Video duration: 3m 58s 4h 23m Intermediate

Viewers:

Migrating custom fields from Drupal 6 provides you with in-depth training on Developer. Taught by Tom Geller as part of the Drupal 7: Reporting and Visualizing Data

Subjects:
Developer Web
Software:
Drupal
Author:
please wait ...