Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Common tests used in liquibase are available here: common.tests.changelog.yaml

Important concepts to be considered

  1. Labels and Context - to separate environments and releases
  2. Tags - to set  a rollback check point
  3. Prechecks - to check if a particular changeSet needs to be executed
  4. Different formats - decide the best one for the team to work with
  5. 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
languageyml
titledbchangelog-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
languagetext
titlerollback_insert_JpaPdpPolicyDeploymentAudit.sql
delete from JpaPdpPolicyDeploymentAudit where id in (9,10);


Important concepts to be considered

  1. Labels and Context - to separate environments and releases
  2. Tags - to set  a rollback check point
  3. Prechecks - to check if a particular changeSet needs to be executed
  4. Different formats - decide the best one for the team to work with
  5. 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

...