Changing attribute type

Author Message

Edward Eliot

Tuesday 07 September 2004 1:21:44 am

Is it possible to change the type of a class attribute without losing data stored in it? I have a textfield and want to change it to an XML textfield? Do I have to make this change direct to the database?

Frederik Holljen

Tuesday 07 September 2004 1:42:13 am

Yes, you would have to make this change directly to the database. You would also have to make sure that the converted text is according to the XML text field standard.

Edward Eliot

Tuesday 07 September 2004 1:53:19 am

Thanks, how do I do this? What tables do I need to change etc? Any ideas?

Edward Eliot

Wednesday 08 September 2004 1:25:25 am

Wah tables do I need to make changes to?

Bård Farstad

Wednesday 08 September 2004 4:32:32 am

To do this you need to change data in the table ezcontentobject_attribute. You need to make sure that you only update rows where the field contentclassattribute_id has the correct id. Valid XML data in the data_text field there can look like:

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
         xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
         xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
  <paragraph>This is some plain text in a paragraph</paragraph>
</section>

Then you need to change the data_type_string to ezxmltext in both ezcontentclass_attribute and ezcontentobject_attribute.

Remember to do a backup before you start testing this.

--bård

Documentation: http://ez.no/doc

Edward Eliot

Monday 13 September 2004 4:07:12 am

Thanks.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.