<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Best way to change document schemas in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/best-way-to-change-document-schemas/m-p/320054#M7055</link>
    <description>&lt;P&gt;Myself I would do the actual data migration step at the SQL level as it's way more efficient and you don't have to write Java or scripting code:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;backup the SQL database,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;create the new schema &lt;EM&gt;SchemaZ&lt;/EM&gt;,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;add the new schema &lt;EM&gt;SchemaZ&lt;/EM&gt; to both document definitions &lt;EM&gt;DocumentA&lt;/EM&gt; and &lt;EM&gt;DocumentB&lt;/EM&gt;,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;remove the old field &lt;EM&gt;FieldZ&lt;/EM&gt; from the old schemas &lt;EM&gt;SchemaA&lt;/EM&gt; and &lt;EM&gt;SchemaB&lt;/EM&gt;,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;start Nuxeo once so that the new table, &lt;CODE&gt;schemaz&lt;/CODE&gt;, is created,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;stop Nuxeo,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;write SQL to copy the old field, something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; INSERT INTO schemaz (id, fieldz) SELECT id, fieldz FROM schemaa;
 INSERT INTO schemaz (id, fieldz) SELECT id, fieldz FROM schemab;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;start Nuxeo,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;check that things are ok with the new schema,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;when you're really sure that all its ok, ALTER the old tables &lt;CODE&gt;schemaa&lt;/CODE&gt; and &lt;CODE&gt;schemab&lt;/CODE&gt; to remove the old &lt;CODE&gt;fieldz&lt;/CODE&gt; column (you should get a WARN about it being an extra unused column at startup).&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;In any case, make sure you start with a backup.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Apr 2012 01:12:33 GMT</pubDate>
    <dc:creator>Florent_Guillau</dc:creator>
    <dc:date>2012-04-17T01:12:33Z</dc:date>
    <item>
      <title>Best way to change document schemas</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/best-way-to-change-document-schemas/m-p/320052#M7053</link>
      <description>&lt;P&gt;I need to make an change to a document schema after the fact. The more particular case is that I need to extract data that is common to 2 schemas and put it in its own schema.&lt;/P&gt;
&lt;P&gt;I have only a vague idea how you can do that on a system that has already been put in production.&lt;/P&gt;
&lt;P&gt;It would be meaningless to detail my particular problem so here is an example of what I'm trying to do.&lt;/P&gt;
&lt;P&gt;Given 2 document types: &lt;STRONG&gt;DocumentA&lt;/STRONG&gt; and &lt;STRONG&gt;DocumentB&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Both documents have their own schema &lt;STRONG&gt;SchemaA&lt;/STRONG&gt; and &lt;STRONG&gt;SchemaB&lt;/STRONG&gt;. The field &lt;STRONG&gt;FieldZ&lt;/STRONG&gt; is common to both schemas  is semantically the same in both document types.&lt;/P&gt;
&lt;P&gt;I want to create another schema SchemaZ, which will include &lt;STRONG&gt;FieldZ&lt;/STRONG&gt;, and which will be included in both &lt;STRONG&gt;DocumentA&lt;/STRONG&gt; and &lt;STRONG&gt;DocumentB&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2012 21:41:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/best-way-to-change-document-schemas/m-p/320052#M7053</guid>
      <dc:creator>fdgonthier_</dc:creator>
      <dc:date>2012-04-16T21:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to change document schemas</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/best-way-to-change-document-schemas/m-p/320053#M7054</link>
      <description>&lt;P&gt;The general approach I would take...&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; - Create the new schema
 - Add the new schema to both document definitions
 - BACKUP everything
 - Write and run a piece of code (with all users disconnected) to iterate over the entire set of "A" and "B" documents and copy the value of FieldZ to the new schema FieldZ
 - Delete the field from "A" and "B" original schemas
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Apr 2012 21:53:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/best-way-to-change-document-schemas/m-p/320053#M7054</guid>
      <dc:creator>bruce_Grant</dc:creator>
      <dc:date>2012-04-16T21:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to change document schemas</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/best-way-to-change-document-schemas/m-p/320054#M7055</link>
      <description>&lt;P&gt;Myself I would do the actual data migration step at the SQL level as it's way more efficient and you don't have to write Java or scripting code:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;backup the SQL database,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;create the new schema &lt;EM&gt;SchemaZ&lt;/EM&gt;,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;add the new schema &lt;EM&gt;SchemaZ&lt;/EM&gt; to both document definitions &lt;EM&gt;DocumentA&lt;/EM&gt; and &lt;EM&gt;DocumentB&lt;/EM&gt;,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;remove the old field &lt;EM&gt;FieldZ&lt;/EM&gt; from the old schemas &lt;EM&gt;SchemaA&lt;/EM&gt; and &lt;EM&gt;SchemaB&lt;/EM&gt;,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;start Nuxeo once so that the new table, &lt;CODE&gt;schemaz&lt;/CODE&gt;, is created,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;stop Nuxeo,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;write SQL to copy the old field, something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; INSERT INTO schemaz (id, fieldz) SELECT id, fieldz FROM schemaa;
 INSERT INTO schemaz (id, fieldz) SELECT id, fieldz FROM schemab;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;start Nuxeo,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;check that things are ok with the new schema,&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;when you're really sure that all its ok, ALTER the old tables &lt;CODE&gt;schemaa&lt;/CODE&gt; and &lt;CODE&gt;schemab&lt;/CODE&gt; to remove the old &lt;CODE&gt;fieldz&lt;/CODE&gt; column (you should get a WARN about it being an extra unused column at startup).&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;In any case, make sure you start with a backup.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2012 01:12:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/best-way-to-change-document-schemas/m-p/320054#M7055</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2012-04-17T01:12:33Z</dc:date>
    </item>
  </channel>
</rss>

