I am using MySql5.0 and ddlutils 1.0.
Here is the create table statement for the existing table:
CREATE TABLE mytable (
column1 int(10) unsigned NOT NULL default '0',
column2 varchar(45) NOT NULL default '',
column3 varchar(7) NOT NULL default '',
column4 tinyint(3) unsigned default NULL,
column5 varchar(45) default NULL,
PRIMARY KEY (column1)
The schema that is generated is:
I would like to see the default values also generated for columns 2 and
3 (default=""). The problem with the current output is that when I add a
new column "column6 varchar(10) not null default ''", the schema
generated does not include the default value. Then, when I try to
upgrade an existing database to this new model, it tries to delete and
recreate this table which is not what we want.
Also, are there any plans to support the "unsigned" types in ddlutils?
Thanks for your quick response.
From: Thomas Dudziak [mailto:email@example.com]
Sent: Wednesday, February 13, 2008 10:19 PM
Subject: Re: Problem with using DdlUtils with MySql
could you post the definition of the existing table (i.e. the CREATE
TABLE statement), and the part from the schema XML that defines how
this table should look like ? Also, which MySql version are you using
On Feb 12, 2008 3:05 PM, Satish Yellanki
> I am trying to use DdlUtil with MySql database to upgrade from one
> version to another. I create a model file from the latest schema and
> to alter an existing database to match that file. However, there is
> problem with the default values.
> Some of the columns have default values defined as "" (empty string),
> while some don't have any default values. However, the DdlUtils
> out of the box is treating them the same... the xml output I create
> not have any default values in it.
> When I add a new column to the database which is "NOT NULL" and has a
> default value of "", the utility is trying to delete the existing
> and recreate it. I understand that this is because the utility assumes
> there is no default value and since it cannot add a NOT NULL column
> without a default, it is deleting and re-creating the table.
> Is there a way I can make MySql handler treat the "" (Empty String)
> null values differently and also, save the "" default values in the
> model file? This could potentially solve my problem.