I'm trying to convert a long-text field into a text-field. The only thing I found so far is the "field_config" table in the database. But any change there is only leading to errors. Do I have to change it somewhere else?
Once a field is created from admin then it can not be edited later. Because field data is saved in Binary form and can not be edited.
e.g if we have field 'test' then it will have table 'field_data_field_test' and 'field_revision_field_test' in the database. Now change its datatype directly in the database.
Export these tables as a sql file and delete the old field in the manage field section of content type using admin.
Create the new field with the same name as it was before and choose the appropriate datatype
- Now delete the newly created table 'field_data_field_test' and 'field_revision_field_test' and import the file that were exported earlier.
Other way you can create a new field and copy the data from old tables to new table and change settings later.
Hope it will help you!
Thanks to Geoff. As my long-text never was bigger than the textfield size (255) I could use this solution with ease. I did it the following:
Created a new field "textfield"
Did a database action:
INSERT INTO newtable (newfields) SELECT oldfields FROM oldtable
and then deleted the old field.
I posted a php script that converts from text field to long_text field. You could easily reverse it: