Solution: How to change the datatype of attributes?

There's no feature currently included with eZ Publish to change an attribute's datatype. However, there are some methods for it already.

Internally compatible datatypes

If a datatype is internally compatible, which means it stores both its class level and object level data in the same way in the database fields of ezcontentobject_attribute and ezcontentclass_attribute, then you can use some simple SQL to change the datatypes. The following example SQL will change all attributes of the datatype with identifier "places" to the datatype with identifier "ezinteger":

UPDATE ezcontentclass_attribute SET data_type_string='ezinteger' WHERE data_type_string='places';
[UPDATE ezcontentobject_attribute SET data_type_string='ezinteger' WHERE data_type_string='places';
 

Non-internally compatible datatypes

There is an experimental extension available at http://ez.no/developer/contribs/datatypes/datatypes. You can write plug-ins for it to handle conversion of specific datatypes.

References