...
- 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 time:
Code Block |
---|
language | yml |
---|
title | dbchangelog-sql10.yaml |
---|
|
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 |
---|
language | text |
---|
title | insert_JpaPdpPolicyDeploymentAudit.sql |
---|
|
insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values
(9, 'TestName', '1.0.0', 'TestGroup', 'TestType', 1, now(), 'Admin'),
(10, 'TestName', '1.0.0', 'TestGroup', 'TestType', 1, now(), 'Admin'); |
Code Block |
---|
language | text |
---|
title | rollback_insert_JpaPdpPolicyDeploymentAudit.sql |
---|
|
delete from JpaPdpPolicyDeploymentAudit where id in (9,10); |