企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# C.8 DbDeployTask 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](http://dbdeploy.com/documentation/getting-started/rules-for-using-dbdeploy/) for more information. You will need a changelog table like so: Table C.9:聽Attributes NameTypeDescriptionDefaultRequired`url``String`PDO connection urln/aYes`userid``String`DB userid to use for accessing the changelog table.noneAs required by db`password``String`DB password to use for accessing the changelog table.noneAs required by db`dir``String`Directory containing dbdeploy delta scripts.noneYes`outputfile``String`Filename in which deployment SQL will be generated.dbdeploy\_deploy.sqlNo`undooutputfile``String`Filename in which undo SQL will be generated.dbdeploy\_undo.sqlNo`deltaset``String`deltaset to check within db.MainNo`lastchangetoapply``Integer`Highest-numbered delta script to apply to db.999No`appliedBy``String`Value of the 'applied\_by' column for each entry in the changelog table.dbdeployNo`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).falseNo C.8.1 Example ``` 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.