My favorites | Sign in
Project Logo
                
Search
for
Updated Oct 18, 2009 by gra...@tackley.net
GeneratingAndCustomisingScripts  
How to get dbdeploy to generate scripts, and how to customise the content of those scripts

Introduction

By default dbdeploy will apply changes directly to the database. This is the recommended way of using dbdeploy.

However, you can get dbdeploy to generate scripts that you then separately apply to the database. You might want to do this because:

Enabling Script Generation

To generate scripts, specify an "outputfile" or an "undoOutputfile". If you do this you then need to specify the database type using the "dbms" paramater:

ora Oracle
syb-ase Sybase ASE
hsql Hypersonic SQL
mssql MS SQL Server
mysql MySQL
db2 DB2
pgsql Postgres

Note: you don't need to specify a dbms type when dbdeploy is applying changes directly: it uses standard sql and jdbc and should therefore work with any database. Raise a bug if it doesn't.

Customising Script Generation

dbdeploy uses simple freemarker templates to generate the scripts. You can see the ones provided at http://code.google.com/p/dbdeploy/source/browse/#svn/trunk/dbdeploy-core/src/main/resources.

You can also supply your own. Probably the easiest thing to do is take one of the included ones and change it. Use the "templatedir" parameter to point to a directory containing your modified templates. dbdeploy will look for files called {dbms}_apply.ftl and {dbms}_undo.ftl in that directory, where {dbms} is what you specified for the dbms parameter.

If you do add support for another mainstream database, or if you have to correct the included scripts, please tell us about it either by raising an issue or posting to the users list.


Sign in to add a comment
Hosted by Google Code