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: DDL Utils...
Date Thu, 11 Oct 2007 05:43:41 GMT
On 10/7/07, satz <satyam.bhatnagar@gmail.com> wrote:

>     Since no answer from the forums, I'm working at the code in the
> SQLBuilder, where i'm trying to modify the approach to handle
> ColumnRequiredChange. I'm handling this as a DML change by using
> "generateUpdateSQL()" against the column with new default value,updating the
> table and applying columnRequiredChange. Hopefully there is a better
> solution than this. BTW faced this problem on MSSQL n Oracle.

Basically what you want to do is to force the platform to recreate the
table instead. The easiest way to achieve this is to add a check for
the exact condition to the processTableStructureChanges (which is
typically redefined in concrete builder implementations).
For an example of how to do this, have a look at the DerbyBuilder
(which is probably the easiest to understand). There, the
processTableStructureChanges method checks whether AddColumnChanges
add or insert columns. Since Derby can only add columns, and only
non-identity ones, it will use the ALTER TABLE ADD COLUMN statement
only in these cases (by explicitly calling the corresponding
processChange method). In all other cases, it will defer to the
default behavior which is rebuilding the table.


View raw message