...
Common tests used in liquibase are available here: common.tests.changelog.yaml
Important concepts to be considered
- Labels and Context - to separate environments and releases
- Tags - to set a rollback check point
- Prechecks - to check if a particular changeSet needs to be executed
- Different formats - decide the best one for the team to work with
- Include rollback statement with changeSet to allow user to undo changes.
Proposed Liquibase Format
Something like the following example might work best for us.
We can use all the liquibase functions with SQL at the same timeand include rollback:
Code Block | ||||
---|---|---|---|---|
| ||||
databaseChangeLog: - changeSet: id: policy-26 author: admin label: release1.5 preConditions: - onFail: HALT - tableExists: tableName: JpaPdpPolicyDeploymentAudit changes: - tagDatabase: tag: 31 - sqlFile: comment: insert JpaPdpPolicyDeploymentAudit dbms: '!h2, oracle, mysql, mariadb' endDelimiter: \nGO splitStatements: true stripComments: true path: sql/insert_JpaPdpPolicyDeploymentAudit.sql relativeToChangelogFile: true rollback: - sqlFile: comment: rollback JpaPdpPolicyDeploymentAudit dbms: '!h2, oracle, mysql, mariadb' endDelimiter: \nGO splitStatements: true stripComments: true path: sql/rollback_insert_JpaPdpPolicyDeploymentAudit.sql relativeToChangelogFile: true |
...
Code Block | ||||
---|---|---|---|---|
| ||||
delete from JpaPdpPolicyDeploymentAudit where id in (9,10); |
Important concepts to be considered
- Labels and Context - to separate environments and releases
- Tags - to set a rollback check point
- Prechecks - to check if a particular changeSet needs to be executed
- Different formats - decide the best one for the team to work with
- Include rollback statement with changeSet to allow user to undo changes.
See Some best practices to keep in mind when using Liquibase for more information
...