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: Does DdlUtils support MySQL MyISAM?
Date Mon, 14 Apr 2008 04:13:04 GMT
On Fri, Apr 11, 2008 at 11:31 AM, Joe Porcheddu
<jporcheddu@tek-tools.com> wrote:
> Hello,
>
>  I have an existing table created in MySQL 4.1. The create table syntax is as
>  follows:
>
>  CREATE TABLE sometable
>  (
>      deviceId INTEGER DEFAULT 0 NOT NULL,
>      plexId INTEGER NOT NULL AUTO_INCREMENT,
>      volumeId INTEGER,
>      PRIMARY KEY (deviceId, plexId)
>  ) ENGINE=MyISAM;
>
>  When I export this table using DdlUtils, then try to import the schema to a
>  new database, I get the following error:
>
>  [ddlToDatabase] SQL Command CREATE TABLE sometable
>  [ddlToDatabase] (
>  [ddlToDatabase]     deviceId INTEGER DEFAULT 0 NOT NULL,
>  [ddlToDatabase]     plexId INTEGER NOT NULL AUTO_INCREMENT,
>  [ddlToDatabase]     volumeId INTEGER,
>  [ddlToDatabase]     PRIMARY KEY (deviceId, plexId)
>  [ddlToDatabase] ) failed with: Incorrect table definition; there can be only
>  one auto column and it must be defined as a key
>
>  The create table syntax is failing because DdlUtils fails to append the
>  "ENGINE=MyISAM" to the end of the CREAT TABLE statement. Is there a way to
>  configure DdlUtils to do this?

Yes, you'll want to use parameter sub element of the
writeSchemaToDatabase subtask:

http://db.apache.org/ddlutils/ant/org.apache.ddlutils.task.WriteSchemaToDatabaseCommand.html

E.g.

<ddlToDatabase>
   ...
   <writeschematodatabase>
     <parameter platforms="MySql,MySql50" name="ENGINE" value="MyISAM"/>
   </writeschematodatabase>
 </ddlToDatabase>

This will add ENGINE=MyISAM to all table creation statements when run
against MySql.

Tom

Mime
View raw message