You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by pa...@bt.com on 2001/09/20 14:55:14 UTC

Keeping data when initialising application

Is it possible to keep data stored in database tables described in the
application/project schema when compiling using ant init?
By default it deletes all data.  Is it a manual process to modify schema in
the database once data is there?

Thanks

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Keeping data when initialising application

Posted by Scott Eade <se...@backstagetech.com.au>.
From: <pa...@bt.com>
> Is it possible to keep data stored in database tables described in the
> application/project schema when compiling using ant init?
> By default it deletes all data.  Is it a manual process to modify schema in
> the database once data is there?
> 
> Thanks
> 
> Paul

The issue is that one of the main functions of the init target is to create the
database tables for the application and that the way this is achieved is to 
drop all of the existing tables (thereby deleting any existing data) and 
recreate them using the altered structure.

I believe someone mentioned a while ago that they were looking into a 
more data friendly way of handling this, but as there has been no further 
evidence of work going on in this area you need to handle the situation
manually yourself.

You need to study the targets in build.xml and rather than using init execute 
only the targets necessary to achieve the desired result.  For a change to 
the database schema you need to execute the target that generates the 
torque code (project-om), if desired you can also execute the target that
generates the sql for creating the tables (project-sql) - you won't run this,
but the output is often helpful when you maintain the tables manually.  The 
target you want to skip is project-insert-sql.  You will also need to execute 
the compile target to produce the class files for the new torque code.  Lastly 
you need to maintain your tables manually using "alter table" sql statements 
of your own devising.  

This is the method I follow with great success.

HTH

Scott


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org