I am using 5.x and have named some CCK fields and then changed the labels such that the field names and label do not correspond well.

Does anybody know the steps to change a field name either in Drupal or Directly in DB. I expect I may have to change in several tables of the DB but was not sure.

Thanks in advance

Comments

tmj2k7’s picture

Are you using the Content module to create new content types? The field manager should allow you do do that in admin/content/types

mjs-1’s picture

Thanks for the reply. The configure screen allows me to change the field label but not the field name.

I would like to know how to change the field name.

yched’s picture

CCK does not provide any UI to do that, since it's not supposed to be a feature.
if you really need to, the steps to do that manually in the db are :

Say you want to rename field_old_name to field_new_name

0- backup you db :-)
1- edit the relevant value in {node_field}.field_name - there should be one line
2- edit the relevant values in {node_field_instance}.field_name and {node_group_fields}.field_name (if you have enabled fieldgroup.module) - there could be several lines to alter

if the field is multiple or shared between several content types
3a- data table is {content_field_old_name}. rename it to {content_field_new_name}

if the field is single or not shared
3b- data table is {content_type_(the_content_type)}; Don't rename

4- in the data table, rename the field_old_name_* columns to field_new_name_*
5- empty tables {cache}, {cache_content} and {cache_views} (if using Views 1.6+)
6- Visit your site and check the results :-) - you'll probably need to resave your the views that refer to the field

yched’s picture

Status: Active » Fixed

support was given

killes@www.drop.org’s picture

Status: Fixed » Closed (fixed)
pvanerk’s picture

You can also try the module CCK Field Rename: http://drupal.org/project/cck_field_rename