db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hank DeGregorio <henry_degrego...@comcast.com>
Subject DdlUtils DB enum column type
Date Mon, 22 Oct 2007 19:00:54 GMT
Hi,

I used the org.apache.ddlutils.task.DatabaseToDdlTask Ant task to generate
an XML representation of a MySQL DB as follows:

<target name="db-dump" description="Dumps the database structure">
  <taskdef name="databaseToDdl"
           classname="org.apache.ddlutils.task.DatabaseToDdlTask">
    <classpath refid="runtime-classpath"/>

  </taskdef>
  <databaseToDdl modelname="foo" verbosity="DEBUG">
    <database  url="jdbc:mysql://localhost/foo"
              driverclassname="com.mysql.jdbc.Driver"
              username="XXXX"
              password="YYYYYYYY"/>

    <writeSchemaToFile outputFile="db-schema.xml"/>
  </databaseToDdl>
</target>

The schema was created successfully, but columns typed as "enum" in MySQL
with a set of allowable values were converted to CHAR types in the XML.  For
example, 

<column name="entity_type1" primaryKey="false" required="false" type="CHAR"
size="3" autoIncrement="false"/>

was generated from a column definition that looks like so in MySQL DDL:

`entity_type1` enum('AA','BB','CC') default NULL

I realize the CHAR typing is valid, but I would like to generate the
database from scratch from the XML representation.  Is there a way to
preserve enums in the XML?

Thanks in advance,
Hank

-- 
Hank DeGregorio
Comcast Interactive Media



Mime
View raw message