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.

eZ debug

Timing: Jan 19 2025 04:37:40
Script start
Timing: Jan 19 2025 04:37:40
Module start 'layout'
Timing: Jan 19 2025 04:37:40
Module start 'content'
Timing: Jan 19 2025 04:37:41
Module end 'content'
Timing: Jan 19 2025 04:37:41
Script end

Main resources:

Total runtime1.5243 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0100 590.2813152.6250
Module start 'layout' 0.01010.0036 742.906339.4453
Module start 'content' 0.01371.5091 782.3516604.4141
Module end 'content' 1.52280.0015 1,386.765612.1719
Script end 1.5243  1,398.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2281160.0002
Check MTime0.00150.0962160.0001
Mysql Total
Database connection0.00120.076910.0012
Mysqli_queries1.466296.1886680.0216
Looping result0.00090.0583660.0000
Template Total1.479097.020.7395
Template load0.00190.125720.0010
Template processing1.477196.901520.7385
Template load and register function0.00020.015710.0002
states
state_id_array0.00160.106410.0016
state_identifier_array0.00170.112120.0009
Override
Cache load0.00160.1063200.0001
Sytem overhead
Fetch class attribute can translate value0.00070.044030.0002
Fetch class attribute name0.00140.093080.0002
XML
Image XML parsing0.00100.063930.0003
class_abstraction
Instantiating content class attribute0.00000.002580.0000
General
dbfile0.00100.0656230.0000
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs