db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak" <tom...@gmail.com>
Subject Re: The DB created from XML has one more index for every table.
Date Mon, 20 Mar 2006 08:06:05 GMT
On 3/19/06, Jun Li <allanjunli@gmail.com> wrote:

> Have you worked it out?

Sorry, was busy with other stuff and hadn't much time for DdlUtils last week.
Anyway, I shortened the schema you provided by removing the attributes
with the default values and the db-created indices:


<database name="build_test">
   <table name="Accrual">
     <column name="AccrualID" primaryKey="true" required="true"
type="NUMERIC" size="8" autoIncrement="true"/>
     <column name="PeriodFK" required="true" type="NUMERIC" size="8"/>
     <column name="FileNameChanged" required="true" type="VARCHAR" size="80"/>
     <column name="AccruedOn" type="TIMESTAMP" autoIncrement="false"/>
     <foreign-key foreignTable="Period" name="FK_Accrual_Period">
       <reference local="PeriodFK" foreign="PeriodID"/>
     </foreign-key>
   </table>
   <table name="Period">
     <column name="PeriodID" primaryKey="true" required="true"
type="NUMERIC" size="8" autoIncrement="true"/>
     <column name="PeriodDesc" required="true" type="VARCHAR" size="50"/>
     <column name="StatementDate" type="TIMESTAMP"/>
     <column name="LastChangedOn" type="TIMESTAMP"/>
     <column name="PeriodMessage" type="VARCHAR" size="1000"/>
   </table>
 </database>


This schema runs just fine through DdlUtils. Running Ant with

ant -Djdbc.properties.file=src/test/jdbc.properties.sqlserver2000
-Dddlutils.platform=mssql -Dschemapattern=DDLUTILS
-Dcatalogpattern=DDLUTILS -f dump-metadata.xml dump-model

(the dump-metadata.xml and jdbc.properties.sqlserver2000 come with
DdlUtils, you only got to adjust the latter) produced this XML:

  <database name="default">
    <table name="Accrual">
      <column name="AccrualID" primaryKey="true" required="true"
type="NUMERIC" size="8" autoIncrement="true"/>
      <column name="PeriodFK" primaryKey="false" required="true"
type="NUMERIC" size="8" autoIncrement="false"/>
      <column name="FileNameChanged" primaryKey="false"
required="true" type="VARCHAR" size="80" autoIncrement="false"/>
      <column name="AccruedOn" primaryKey="false" required="false"
type="TIMESTAMP" size="23" autoIncrement="false"/>
      <foreign-key foreignTable="Period" name="FK_Accrual_Period">
        <reference local="PeriodFK" foreign="PeriodID"/>
      </foreign-key>
    </table>
    <table name="Period">
      <column name="PeriodID" primaryKey="true" required="true"
type="NUMERIC" size="8" autoIncrement="true"/>
      <column name="PeriodDesc" primaryKey="false" required="true"
type="VARCHAR" size="50" autoIncrement="false"/>
      <column name="StatementDate" primaryKey="false" required="false"
type="TIMESTAMP" size="23" autoIncrement="false"/>
      <column name="LastChangedOn" primaryKey="false" required="false"
type="TIMESTAMP" size="23" autoIncrement="false"/>
      <column name="PeriodMessage" primaryKey="false" required="false"
type="VARCHAR" size="1000" autoIncrement="false"/>
    </table>
  </database>


which is the same as the sample schema.
Btw, I found that it is important to set both catalog and schema
patterns to the name of the database all in uppercase (DDLUTILS in my
case) in order to get useful results.

Tom

Mime
View raw message