Last updated December 26, 2013. Created on May 1, 2011.
Edited by flaviovs, LWVMD, colan, Edgar Saumell. Log in to edit this page.

Data must be migrated to upgrade Content Construction Kit (CCK) in Drupal 6 to Drupal 7 core fields. Much but not all of CCK functionality is now part of Drupal 7 core. Several features require the installation of new, dedicated 7.x modules.

The following instructions describe the steps necessary to migrate CCK for a site that was upgraded from Drupal 6 to Drupal 7. Learn more on upgrading from Drupal 6 to Drupal 7.

Upgrade Steps

  1. Download latest 7.x CCK module

    After upgrading to Drupal 7, download the latest 7.x CCK module version (http://www.drupal.org/project/cck). Typically this will be placed in your sites/all/modules or sites/example.com/modules directory.

  2. Enable the CCK Content Migrate module

    Browse to http://example.com/admin/modules and check the box next to Content Migrate in the CCK field group. Remember to press save configuration at the bottom of the screen. You may need to clear your cache in order for the Migrate fields option to be displayed in the next step.

  3. Browse to the Migrate fields page

    Browse to Structure > Migrate Fields or http://example.com/admin/structure/content_migrate for a page to walk you through the migration process.

  4. The Migrate Fields page is divided into 3 sections:

    Available fields- Fields that have not been migrated but are available for migration. Some fields will be listed as available, but may have attributes that will be lost (e.g., option widgets, permission setting for that field, the attached image) because the appropriate module has yet to be enabled. If you care about that attribute, enable the supporting modules BEFORE migrating the field.

    Converted fields- Fields that have already been converted. You can choose to roll them back if the conversion did not work correctly. Note that rolling fields back will completely destroy the new field tables. This operation cannot be undone!

    Unavailable fields- Fields that cannot be migrated because some modules are missing. Download and install/enable any required modules listed in the Other information column (aka Step 4) of this section.

    Note: If you find that some image or file fields cannot be migrated, check to make sure that the Drupal Core 'field', 'file' and 'image' modules are enabled.

    If you are getting "exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064" errors while migrating fields with autocomplete_widgets, you should install version 7.x-1.x-dev of Autocomplete Widgets for Text and Number Fields module as this is fixed in #1790758: PDO exception on migrate autocomplete_widgets longtext field.

  5. Download additional modules if necessary

    Typically these will be placed in your sites/all/modules or sites/example.com/modules directory. Be sure to back up your database and run update.php after enabling a module.

  6. Enable additional modules if necessary

    Browse to http://example.com/admin/modules and check all applicable boxes in the Fields section. Remember to press save configuration at the bottom of the screen.

  7. Migrate fields

    Browse to Structure > Migrate Fields or http://example.com/admin/structure/content_migrate.

    Check the box next to all fields you would like to migrate in the Available fields section.

    Press the Migrate selected fields button.

    If the migration process is successful you should receive a message detailing that each field was created. All fields should now be listed in the Converted fields section of the page.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

j9’s picture

Thank you for creating this howto and migration code! :0)

roxtaz’s picture

What next? Can I uninstall old 6.x CCK modules, or all CCK modules? And if some CK modules can't be uninstalled how cand I know what remains to manually remove?

Have fun!
Marian Bîrlădeanu :: Twitter roxtaz :: FB roxtaz

harriska2’s picture

I have the same question, once migrated, can the CCK module for D7 be removed?

Peter Swietoslawski’s picture

Yes, once you migrate all your CCK fields from 6.x to 7 you can disable, uninstall and remove CCK module. At least that's what I did and worked for me.

twardnw’s picture

I am working on a site upgrade from D6->D7, wondering if there is a way I can trigger content_migrate via a hook_update in my site's custom module?

--Tyler--

axle_foley00’s picture

I am wondering the same thing. Is there an automated way to make content_migrate convert the fields?

jarl’s picture

Interesting that this article is about how to migrate from D6 CCK module to D7 Fields.

First step is to download "latest 7.x CCK module", but navigating to http://drupal.org/project/cck and looking at the git repository there is no branches nor tags for 7.x. I wonder how the tar files have been created. I don't believe they are right if I cannot track the back to source control.

Please help...

Jarl

axle_foley00’s picture

Jarl:

The master branch of the repository is now the D7 version. See http://drupalcode.org/project/cck.git/tree and click on the cck.info file, you'll see "core" is set to 7.x.

jarl’s picture

Thanks for reply. That is interesting...

That should probably be mentioned on http://drupal.org/project/cck

Further If I download the tar file from http://drupal.org/node/267843 the tar files contains code that does not exist anywhere in the git repository.

So which should I use the tar file or the HEAD of the master branch in the git repo? And why is the code in the tar file not committed to the git repo.

Jarl

bettledupls’s picture

I have advanced forum module on Drupal 6 and needed to export only that module and data to Drupal 7 but the fields are different. So a simple export/import wouldn't work.
Solution was to upgrade Drupal 6 site to Drupal 7.

monalisab’s picture

Thank you very much for this nice documentation.
Really appreciated....

Thanks...
Monalisa

Thanks...
Monalisa

rayjames’s picture

I am in the process of upgrading a massive D6 site to D7 and had a ton of users as well as custom content types including two file_field types. Everything so far has upgraded really smooth and well. I am very impressed with all of you amazing folks who have written all these upgrade tools and instructions. Very well done sirs and madams. :)

Ray James

nicjasno’s picture

When i try this, i get a huge problem with fields containing images.

    Caution: The 'field_node_images' field is a shared field that uses different widgets. The 'filefield_widget' widget is sometimes used to determine the destination field type for the new field. The migration may not work correctly if other widgets used by this shared field would create different results.
    Changed field type: The 'field_node_images' field type will be changed from 'filefield' to 'file'.
    Missing widget: The 'image' widget is not available for the field_node_images field, it will be set to the default widget.
    Missing formatter: The 'hidden' formatter used in 3 view modes for the field_node_images field is not available, these displays will be reset to the default formatter.
    Missing widget: The 'image' widget is not available for the field_node_images field, it will be set to the default widget.
    Missing formatter: The 'hidden' formatter used in 3 view modes for the field_node_images field is not available, these displays will be reset to the default formatter.
    Missing formatter: The 'hidden' formatter used in 3 view modes for the field_node_images field is not available, these displays will be reset to the default formatter.
    Missing widget: The 'image' widget is not available for the field_node_images field, it will be set to the default widget.
    Missing formatter: The 'hidden' formatter used in 3 view modes for the field_node_images field is not available, these displays will be reset to the default formatter.
    Missing formatter: The 'hidden' formatter used in 3 view modes for the field_node_images field is not available, these displays will be reset to the default formatter.

All core modules are enabled and i've installed whatever support modules were necessary/available.

Been searching for weeks for a sollution to convert those fields from d6 to d7 now, without success.

This is so frustrating. Please help! :(

nicjasno’s picture

nicjasno’s picture

After weeks trying to figure this out, it seems that this doesn't manage to migrate the most basic thing, images.

In D6 i have a FileField with an image widget. Bone stock, no custom stuff. That's the only way to get images into D6 cck fields.
And in D7 the options are FileField with a file widget and ImageField with an Image widget

And so, the module complains:

Missing widget: The 'image' widget is not available for the field_node_images field, it will be set to the default widget.

If i do migrate anyway, a cck field is created, but it is of course empty.

A situation that seemingly can't be resolved. I am now facing to have to create the cck fields and then manually reupload all the images into about 400+ nodes. I'd really like some insight into this. Not looking forward to this :(

csuggs4’s picture

I'm in the process of upgrading a site from 6 to 7 that has a number of images through the d6 cck image field. See the Upgrading section of https://drupal.org/project/image for information on converting to Image fields using the Field convert module. I've not worked through this yet, but it looks like it has some promise.

kenorb’s picture

For: "The 'image' widget is not available.", make sure that you've necessary modules enabled such as Image and content_migrate (CCK).

LWVMD’s picture

The Image widget is NOT available even with modules Image and content_migrate CCK enabled. Is there another module that needs to be enabled?

kenorb’s picture

Image module which is part of CCK for 7.x should be enough.
See also:
https://drupal.org/sandbox/kenorb/migrate_styles
Make sure that you cleared all the caches (including memcached if you're using it).

markj’s picture

If you have CCK text fields that have no maximum length value, you need to consult https://drupal.org/node/1117028 . Long story short: give them maximum lengths <= 255 before running Migrate Content.

ling-drupal’s picture

Hi, as I understand cck is part of core in D7, apart from few features. so after upgrade to D7, we should have cck as core module in the sytem, is that right? if so, in your first step "Download latest 7.x CCK module. After upgrading to Drupal 7, download the latest 7.x CCK module version (http://www.drupal.org/project/cck)." - what this mean, i went to www.drupal.org/project/cck, there is no version for D7 except 7.x-2.x-dev.
in other words, do you mean i need to download 7.x-2.x-dev and install it. after content fields migrated, then remove this module. your answer will be appreciated.

Thanks lots! Ling

alexrose’s picture

[to be deleted]

alexrose’s picture

Hello,
I get this message "An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=8499&op=do StatusText: error ResponseText: " every time i try to migrate a filefiled;
Please advise! Thanks!

retiredpro’s picture

what worked for me was applying the patch here
https://drupal.org/node/1463602

And having the latest 6.x filefield module in my sites/all/modules directory. After migrating i deleted the filefield module folder.

hope this helps

usefu’s picture

Note - I posted this here too, wasn't sure where it belonged...

--------

I'm having an issue migrating Multiselect content from D6 to D7. Using the D7 CCK Migrate Fields module, I've managed to move some fields, but none of 4 that use the 'multiselect_select' widget.

CCK Migrate Fields reports: Missing widget: The 'multiselect_select' widget is not available for the field_services_provided field, it will be set to the default widget.

After trying to migrate in spite of this message returns the following (x4):

Error creating field field_services_provided
exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') NULL DEFAULT NULL, `field_services_provided_format` VARCHAR(255) NULL DEFAULT' at line 9' in /home/cowtown/subdomains/mxc/includes/database/database.inc:2168 Stack trace: #0 /home/cowtown/subdomains/mxc/includes/database/database.inc(2168): PDOStatement->execute(Array) #1 /home/cowtown/subdomains/mxc/includes/database/database.inc(680): DatabaseStatementBase->execute(Array, Array) #2 /home/cowtown/subdomains/mxc/includes/database/schema.inc(661): DatabaseConnection->query('CREATE TABLE {f...') #3 /home/cowtown/subdomains/mxc/includes/database/database.inc(2717): DatabaseSchema->createTable('field_data_fiel...', Array) #4 /home/cowtown/subdomains/mxc/modules/field/modules/field_sql_storage/field_sql_storage.module(216): db_create_table('field_data_fiel...', Array) #5 [internal function]: field_sql_storage_field_storage_create_field(Array) #6 /home/cowtown/subdomains/mxc/includes/module.inc(866): call_user_func_array('field_sql_stora...', Array) #7 /home/cowtown/subdomains/mxc/modules/field/field.crud.inc(180): module_invoke('field_sql_stora...', 'field_storage_c...', Array) #8 /home/cowtown/subdomains/mxc/sites/all/modules/cck/modules/content_migrate/includes/content_migrate.admin.inc(246): field_create_field(Array) #9 [internal function]: _content_migrate_batch_process_create_fields('field_services_...', Array) #10 /home/cowtown/subdomains/mxc/includes/batch.inc(284): call_user_func_array('_content_migrat...', Array) #11 /home/cowtown/subdomains/mxc/includes/batch.inc(161): _batch_process() #12 /home/cowtown/subdomains/mxc/includes/batch.inc(80): _batch_do() #13 /home/cowtown/subdomains/mxc/modules/system/system.admin.inc(2365): _batch_page() #14 [internal function]: system_batch_page() #15 /home/cowtown/subdomains/mxc/includes/menu.inc(517): call_user_func_array('system_batch_pa...', Array) #16 /home/cowtown/subdomains/mxc/index.php(21): menu_execute_active_handler() #17 {main}

I've walked through the CCK migration guide, which references an PDOException errors, but only in reference to 'autocomplete_widget' widgets.

Any thoughts on this? Any help would be appreciated.

- Todd

ssantaana’s picture

I am upgrading a site from d6 to d7 and I am having trouble getting the optionwidgets_onoff (boolean) field data to migrate to d7.

In my d6 content types, I have mapped the values like: 0|No and 1|yes, 0|Not a student film and 1|Student film and make the corresponding changes to the tables in the d6 database for reflect the 0 and 1 keys.

I do all the appropriate things before going to migrate fields in d7. I do migrate all the available fields successfully, but when I check my d7 site and d7 db which contain the boolean type data, they are all set to 0. For some reason the data is not moving over doing the field migration.

I'm a new drupal dev and I can't seem to solve this seemingly simple issue. If someone can point me to the right direction, I would be eternally grateful. Thanks!

- S

marek.d’s picture

Hello.

I am in the process of migrating D6 to D7 on localhost. I have enabled the D7 CCK modles, saved, cleared all cache, checked permissions (only see option for "Use PHP input for field settings" under CCK). I am missing the Migrate Fileds option.

Any suggestions would be appreciated.

rituraj.gupta’s picture

Hi marek.d, You need to install content migrate module and after install you can see migrated fields in /admin/structure/content_migrate url. I hope this will help you

Rituraj