The DbDeployTask
creates .sql files for making revisions to a
database, based on dbdeploy conventions centering around a changelog table in the
database. See rules for using dbdeploy for more information. You will need a changelog
table like so:
Table C.8: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
url | String | PDO connection url | n/a | Yes |
userid | String | DB userid to use for accessing the changelog table. | none | As required by db |
password | String | DB password to use for accessing the changelog table. | none | As required by db |
dir | String | Directory containing dbdeploy delta scripts. | none | Yes |
outputfile | String | Filename in which deployment SQL will be generated. | dbdeploy_deploy.sql | No |
undooutputfile | String | Filename in which undo SQL will be generated. | dbdeploy_undo.sql | No |
deltaset | String | deltaset to check within db. | Main | No |
lastchangetoapply | Integer | Highest-numbered delta script to apply to db. | 999 | No |
appliedBy | String | Value of the 'applied_by' column for each entry in the changelog table. | dbdeploy | No |
checkall | Boolean | False means dbdeploy will only apply patches that have a higher number than the last patchnumber that was applied True means dbdeploy will apply all changes that aren't applied already (in ascending order). | false | No |
CREATE TABLE changelog ( change_number BIGINT NOT NULL, delta_set VARCHAR(10) NOT NULL, start_dt TIMESTAMP NOT NULL, complete_dt TIMESTAMP NULL, applied_by VARCHAR(100) NOT NULL, description VARCHAR(500) NOT NULL )
<dbdeploy url="sqlite:${project.basedir}/data/db.sqlite" userid="dbdeploy" password="dbdeploy" dir="${project.basedir}/data/dbdeploy/deltas" />
The above example uses a sqlite database and delta scripts located in dbdeploy/deltas in the project base dir.