db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ludwig Magnusson" <lud...@itcatapult.com>
Subject [PROPOSAL] Migrate
Date Tue, 01 Dec 2009 09:07:03 GMT

I'm working in a project where we are releasing new versions of our webapp
regularly and often. In every release there may or may not be changes to the
database. As far as I know there is no really smooth way of doing a release
like this. I need to create an sql-file that contains the changes of the
database and it needs to be correct in every way.

Or I could extract the entire production database, make the changes in the
extracted file, then drop the production database and insert it again with
the new file. 

Besides this I need to deploy the webapp. No solution is great but I have a
proposal for solving this.


The premises are these:

.         You have a live running webapp at a public sever which people are

.         The public app has its database structure that may or may not
change between releases.

.         The public app has data in the database that you wish to keep
between releases (unless a certain table or column in a table were to be
removed. This would of course also remove the data of that table/column).
This is data like user accounts, products or whatever your database consists


.         In your development environment you have a schema-xml file
describing your database.

.         You have some data that is essential to your database, such as
permissions etc.

.         You have some data that is not essential but used for e.g.
functional testing, such as mock users, mock products etc.


.         When you release a new version you want to merge the structure in
your development environment with the existing one in your production
environment (add/remove tables/columns/constraints).

.         You also want to add new essential data.


My proposal is to create a new torque task called migrate that solves this
(if possible).

The execution would work like this:


1.       Validate the development version of schema-xml.

2.       Extract the database structure from the production environment.

3.       Compare it to the schema-xml from development.

4.       Create an sql file (or equivalent) from the comparison, only
containing statements like create/alter/drop table/constraint for the tables
that need changing.

5.       Execute the created file.

6.       Insert essential data from the data.xml


This feature would make it possible to release a new version of the webapp,
containing database changes, with one single maven command and I would like
some feedback on the idea. If this is an interesting feature, me and my team
are willing to put a lot of effort into developing it, but we would also
appreciate help from experienced torque developers on how basic torque
functions work since we are not that familiar with the torque code.


Open for feedback


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message