You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Joe Porcheddu <jp...@tek-tools.com> on 2008/04/11 20:31:00 UTC
Does DdlUtils support MySQL MyISAM?
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?
Thanks,
Joe
Re: Does DdlUtils support MySQL MyISAM?
Posted by Thomas Dudziak <to...@gmail.com>.
On Fri, Apr 11, 2008 at 11:31 AM, Joe Porcheddu
<jp...@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