You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by John <in...@yahoo.com> on 2003/01/21 20:31:28 UTC

[sql] [PATCH] on-the-fly schema updates to existing db

I have completed major changes to the sql sandbox
project.  The changes add the capability to generate
ddl to alter an existing database to match the current
desired schema.  The ant tasks were enhanced to
support this as well as executing the ddl against a
database connection.  I have included a new test case
that tests creation of a table and subsequent
alterations.  The test passes against mySQL, and all
existing tests still work.  I do not have other
databases to test against.  I hope this spurs interest
in the project and keeps it alive.

There were several areas where I had questions or
concerns.  See SqlBuilder.columnsDiffer,
MySqlBuilder.shouldGeneratePrimaryKeys.  Also, I added
support for declaring unique indexes in the
Torque-style <unique> tag.  Can Betwixt just add a
normal Index object based on a <unique> tag?  This
would eliminate having the extra classes around.  The
uniques are output as regular index tags from
DatabaseWriter, so this may cause some round-trip
problems.  

Still unfinished is support for syncing constraints.

Please contact me with questions/comments.  I have
placed the diff and new files at
http://www.sharemation.com/~funkbaby/public/sql-alter-patchfiles.zip

Sorry for the Yahoo! account but I wasn't sure how
spam-free the list is.
John Marshall

-------------------------
Changes to project
    changed commons-collections version
    fixed resource tag in build
    reordered tags for project xsd

Changes to builder
    added alter database ability to SqlBuilder
    removed table and column instance variables in
SqlBuilder in favor of parameter passing
    changed builder impls for signature changes
    changed mysql shouldGeneratedPrimaryKeys impl
    used line.separator when outputting sql
    created one item versions of foreign key and index
writing and called from collection writing methods
    

Changes to IO
    read indexes in JdbcModelReader

Changes to model
    added a version attribute to Database for external
use (eg data conversions)
    added element name to betwixt files, hide uniques
on table output
    added longer toString in Column
    added unique ability to Index
    added findIndex to Table
    ? added UniqueIndex/UniqueColumn to add support
for Torque-style <unique> tags in the schema xml.  Is
there a way to map this with Betwixt instead of adding
two largely useless classes?

Changes to task
    added a DatabaseTask abstract utility class from
JdbcToSchemaTask
    changed JdbcToSchemaTask to extend DatabaseTask
    modified DDLTask adding support for creating alter
ddl and updating an existing database

Changes to util
    changed DDLExecutor so SqlBuilder isn't required;
made evaluateBatch public
    added constructors to DataSourceWrapper, changed
driver loading to drop 2 exception types


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [sql] [PATCH] on-the-fly schema updates to existing db

Posted by Jason van Zyl <ja...@zenplex.com>.
On Tue, 2003-01-21 at 14:31, John wrote:
> I have completed major changes to the sql sandbox
> project.  The changes add the capability to generate
> ddl to alter an existing database to match the current
> desired schema.  The ant tasks were enhanced to
> support this as well as executing the ddl against a
> database connection.  I have included a new test case
> that tests creation of a table and subsequent
> alterations.  The test passes against mySQL, and all
> existing tests still work.  I do not have other
> databases to test against.  I hope this spurs interest
> in the project and keeps it alive.
> 

Oh, I think things are just fine :-)

I'll take a look at your changes and try to integrate them this weekend
if no one else gets to them.

-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>