Closed (won't fix)
Project:
Content Construction Kit (CCK)
Version:
6.x-1.x-dev
Component:
General
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Oct 2006 at 10:10 UTC
Updated:
22 Nov 2008 at 00:00 UTC
Is there any way to do this? For example, back a long time ago I created a field for phone number which was an integer. I quickly realized that making this field an integer was a mistake since it wouldn't accept characters other than numbers. Without having to create a new field is there a way that I can go back and change this field from being a number to text, or even better, to the phone.number field?
Comments
Comment #1
yched commentedVery unlikely - different field types have different options, there's no generic way to make a "translation".
You have to delete the "wrong" field and create a new one - or, if you don't want to lose the date, maybe you can try messing directly with the database...
Comment #2
jlevis commentedI have run to this same problem. I have a field for program code that I thought was all integers, but have just found out some of them have a letter as the first character. Unfortunately, I have already entered data for a few hundred nodes.
Does anyone know if this would be doable by doing an export then import of some sort?
Comment #3
yched commented@jasonlevis : nope. A 'converter' module could come at some point, but not in any near future AFAIK.
Until then, you have to mess with the db directly - *please* make a db backup before doing anything !
- number fields and (unformatted) text fields have the same storage structure, so there should be no need to mess with the data tables (content_[field|type]_*)
- you need to change the field and field instance definitions in {content_node_field} and {content_node_field_instance} :
Assuming your field is named field_to_be_changed :
Best way to go is to create a dummy text field (field_dummy), and set it with the exact settings you'll want for your field_to_be_changed. If your original field_to_be_changed field is shared in several content types, share field_dummy all the same.
Then run the following queries :
Untested and from the top of my head, but should work.
This will pretty badly break Views that use this field as a filter or argument, you'll need to edit and fix them by hand.