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: DdlUtils DB enum column type
Date Thu, 25 Oct 2007 07:30:50 GMT
Hi Hank,

On 10/22/07, Hank DeGregorio <henry_degregorio@comcast.com> wrote:

> 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?

the column is read as type CHAR because that is what the JDBC driver
reports (since JDBC lacks an enum datatype). Enums would require
native type support in the database model which DdlUtils currently
does not have (see also
http://issues.apache.org/jira/browse/DDLUTILS-86).

Tom

Mime
View raw message