You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by jt...@apache.org on 2006/03/14 01:23:03 UTC
svn commit: r385703 - in /db/derby/site/trunk:
build/site/integrate/db_ddlutils.html
src/documentation/content/xdocs/integrate/db_ddlutils.xml
Author: jta
Date: Mon Mar 13 16:23:01 2006
New Revision: 385703
URL: http://svn.apache.org/viewcvs?rev=385703&view=rev
Log:
Modified DdlUtils example:
(1) Added modelName to export-source-db, which avoids having to edit the
generated schema file (Tom Dudziak just implemented that functionality).
(2) Added notes for when you might want to edit the generated schema file.
Modified:
db/derby/site/trunk/build/site/integrate/db_ddlutils.html
db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml
Modified: db/derby/site/trunk/build/site/integrate/db_ddlutils.html
URL: http://svn.apache.org/viewcvs/db/derby/site/trunk/build/site/integrate/db_ddlutils.html?rev=385703&r1=385702&r2=385703&view=diff
==============================================================================
--- db/derby/site/trunk/build/site/integrate/db_ddlutils.html (original)
+++ db/derby/site/trunk/build/site/integrate/db_ddlutils.html Mon Mar 13 16:23:01 2006
@@ -234,13 +234,13 @@
<a href="#Step+5%3A+Books2+--+Create+Database+and+Import+Schema+and+Data">Step 5: Books2 -- Create Database and Import Schema and Data</a>
<ul class="minitoc">
<li>
-<a href="#Copy+and+modify+the+db-schema.xml+file">Copy and modify the db-schema.xml file</a>
+<a href="#Copy+and+%28maybe%29+modify+the+db-schema.xml+file">Copy and (maybe) modify the db-schema.xml file </a>
</li>
<li>
<a href="#Add+an+import+target+to+the+build.xml">Add an import target to the build.xml</a>
</li>
<li>
-<a href="#Execute+the+Ant+task-N10203">Execute the Ant task</a>
+<a href="#Execute+the+Ant+task-N1021F">Execute the Ant task</a>
</li>
</ul>
</li>
@@ -499,7 +499,7 @@
<classpath refid="classpath"/>
</taskdef>
- <databaseToDdl>
+ <databaseToDdl modelName="MigrateTest">
<database url="jdbc:derby:Books1"
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
username=""
@@ -532,6 +532,12 @@
<ul>
<li>
+<span class="codefrag">modelName</span> specifies a name for the model and will
+ be assigned to the <span class="codefrag">name</span> attribute in the generated
+ schema file.
+ </li>
+
+<li>
<span class="codefrag">database url</span> specifies all the connection parameters
for the database, including the <span class="codefrag">Books1</span> database.
This example uses the Derby Embedded JDBC driver (<span class="codefrag">derby.jar</span>),
@@ -552,7 +558,7 @@
</li>
</ul>
-<a name="N10162"></a><a name="Execute+the+Ant+task"></a>
+<a name="N1016A"></a><a name="Execute+the+Ant+task"></a>
<h3 class="boxed">Execute the Ant task</h3>
<p>
Now execute the task with <span class="codefrag">ant</span>:
@@ -574,7 +580,7 @@
</div>
-<a name="N10187"></a><a name="Step+5%3A+Books2+--+Create+Database+and+Import+Schema+and+Data"></a>
+<a name="N1018F"></a><a name="Step+5%3A+Books2+--+Create+Database+and+Import+Schema+and+Data"></a>
<h2 class="boxed">Step 5: Books2 -- Create Database and Import Schema and Data</h2>
<div class="section">
<p>
@@ -584,8 +590,8 @@
<a href="http://db.apache.org/ddlutils/ant-tasks.html">DdlUtils Ant tasks</a>
to execute the import.
</p>
-<a name="N1019A"></a><a name="Copy+and+modify+the+db-schema.xml+file"></a>
-<h3 class="boxed">Copy and modify the db-schema.xml file</h3>
+<a name="N101A2"></a><a name="Copy+and+%28maybe%29+modify+the+db-schema.xml+file"></a>
+<h3 class="boxed">Copy and (maybe) modify the db-schema.xml file </h3>
<p>
The export step created a file called <span class="codefrag">db-schema.xml</span>. Copy that
to a new file called <span class="codefrag">project-schema.xml</span>:
@@ -597,17 +603,30 @@
<strong>Windows</strong>
copy db-schema.xml project-schema.xml</p>
<p>
-Now modify the first line in the <span class="codefrag">project-schema.xml</span> file
-to name the schema:
-</p>
-<p class="code-block"><database name="MigrateTest"></p>
-<p>
-If you don't provide a name, you'll get the error shown below when you
-run the Ant task to create the schema in the new database:
+Since Derby is both the source and target databases in this example, no
+changes to the generated schema file are required.
+However, changes might be required if the source database is not Derby,
+for example, to change the mapping of a data type:
</p>
-<p class="code-block">build.xml:33: Could not read schema file
-project-schema.xml: The database model has no name</p>
-<a name="N101C4"></a><a name="Add+an+import+target+to+the+build.xml"></a>
+<ul>
+
+<li> Derby does not support the <span class="codefrag">BOOLEAN</span> type
+ (<a class="external" href="http://issues.apache.org/jira/browse/DERBY-499">yet</a>).
+ Use a SQL <a class="external" href="http://mail-archives.apache.org/mod_mbox/db-derby-user/200412.mbox/%3c41C052AB.4050804@debrunners.com%3e"><span class="codefrag">SMALLINT</span></a>
+ instead.
+ </li>
+
+<li> A Derby user
+ <a class="external" href="http://mail-archives.apache.org/mod_mbox/db-derby-user/200603.mbox/%3c007e01c64635$4ae17b60$dd00a8c0@itsdev.infotechsoft.com%3e">posted</a>
+ that he edited the generated schema file to change some
+ <span class="codefrag">LONG VARCHAR</span>s in the source database
+ to a <span class="codefrag">VARCHAR(32672)</span> to retain search ability
+ and others to <span class="codefrag">CLOB</span> to retain long text > 32,672
+ characters.
+</li>
+
+</ul>
+<a name="N101E0"></a><a name="Add+an+import+target+to+the+build.xml"></a>
<h3 class="boxed">Add an import target to the build.xml</h3>
<p>
Copy the source for the <span class="codefrag">import-target-db</span> target below
@@ -658,7 +677,7 @@
</li>
</ul>
-<a name="N10203"></a><a name="Execute+the+Ant+task-N10203"></a>
+<a name="N1021F"></a><a name="Execute+the+Ant+task-N1021F"></a>
<h3 class="boxed">Execute the Ant task</h3>
<p>
Execute the task with <span class="codefrag">ant</span>:
@@ -687,7 +706,7 @@
</div>
-<a name="N1021C"></a><a name="Step+6%3A+Verify+Migration"></a>
+<a name="N10238"></a><a name="Step+6%3A+Verify+Migration"></a>
<h2 class="boxed">Step 6: Verify Migration</h2>
<div class="section">
<p>
@@ -708,7 +727,7 @@
</div>
-<a name="N10238"></a><a name="Caveats"></a>
+<a name="N10254"></a><a name="Caveats"></a>
<h2 class="boxed">Caveats</h2>
<div class="section">
<p>
@@ -721,7 +740,7 @@
</div>
-<a name="N10246"></a><a name="Questions%3F"></a>
+<a name="N10262"></a><a name="Questions%3F"></a>
<h2 class="boxed">Questions?</h2>
<div class="section">
<p>Please post questions about this example to
@@ -733,7 +752,7 @@
<p>
-<em>Last Updated: March 10, 2006</em>
+<em>Last Updated: March 13, 2006</em>
</p>
Modified: db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml
URL: http://svn.apache.org/viewcvs/db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml?rev=385703&r1=385702&r2=385703&view=diff
==============================================================================
--- db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml (original)
+++ db/derby/site/trunk/src/documentation/content/xdocs/integrate/db_ddlutils.xml Mon Mar 13 16:23:01 2006
@@ -260,7 +260,7 @@
<classpath refid="classpath"/>
</taskdef>
- <databaseToDdl>
+ <databaseToDdl modelName="MigrateTest">
<database url="jdbc:derby:Books1"
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
username=""
@@ -291,6 +291,10 @@
<li>The <code>export-source-db</code> target exports the schema and data
from a database.
<ul>
+ <li><code>modelName</code> specifies a name for the model and will
+ be assigned to the <code>name</code> attribute in the generated
+ schema file.
+ </li>
<li><code>database url</code> specifies all the connection parameters
for the database, including the <code>Books1</code> database.
This example uses the Derby Embedded JDBC driver (<code>derby.jar</code>),
@@ -340,7 +344,7 @@
</p>
<section>
- <title>Copy and modify the db-schema.xml file</title>
+ <title>Copy and (maybe) modify the db-schema.xml file </title>
<p>
The export step created a file called <code>db-schema.xml</code>. Copy that
@@ -354,21 +358,27 @@
copy db-schema.xml project-schema.xml</p>
<p>
-Now modify the first line in the <code>project-schema.xml</code> file
-to name the schema:
+Since Derby is both the source and target databases in this example, no
+changes to the generated schema file are required.
+However, changes might be required if the source database is not Derby,
+for example, to change the mapping of a data type:
</p>
-<p class="code-block"><database name="MigrateTest"></p>
-
-<p>
-If you don't provide a name, you'll get the error shown below when you
-run the Ant task to create the schema in the new database:
-</p>
-
-<p class="code-block">build.xml:33: Could not read schema file
-project-schema.xml: The database model has no name</p>
-
-
+<ul>
+ <li> Derby does not support the <code>BOOLEAN</code> type
+ (<a href="http://issues.apache.org/jira/browse/DERBY-499">yet</a>).
+ Use a SQL <a href="http://mail-archives.apache.org/mod_mbox/db-derby-user/200412.mbox/%3c41C052AB.4050804@debrunners.com%3e"><code>SMALLINT</code></a>
+ instead.
+ </li>
+ <li> A Derby user
+ <a href="http://mail-archives.apache.org/mod_mbox/db-derby-user/200603.mbox/%3c007e01c64635$4ae17b60$dd00a8c0@itsdev.infotechsoft.com%3e">posted</a>
+ that he edited the generated schema file to change some
+ <code>LONG VARCHAR</code>s in the source database
+ to a <code>VARCHAR(32672)</code> to retain search ability
+ and others to <code>CLOB</code> to retain long text > 32,672
+ characters.
+</li>
+</ul>
</section>
@@ -507,7 +517,7 @@
</section>
-<p><em>Last Updated: March 10, 2006</em></p>
+<p><em>Last Updated: March 13, 2006</em></p>
</body>
</document>