Liquibase changeLog Testing

Setup

Create a new java project

Add liquibase.properties

liquibase.properties
 changeLogFile: dbchangelog.xml
 url: jdbc:mariadb://localhost:3306/policy
 username: policy
 password: *****


Add dbchangelog.xml

dbchangelog.xml
<?xml version="1.0" encoding="UTF-8"?>
 <databaseChangeLog  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"  
                    xmlns:pro="http://www.liquibase.org/xml/ns/pro"  
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
                    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">  
 

     <changeSet  id="policy-1"  author="policy"> 
         <preConditions  onFail="HALT">  
             <sqlCheck  expectedResult="1">SELECT count(1) FROM  information_schema.tables 
                                           WHERE table_name = 'PDPSTATISTICS'
             </sqlCheck>  
         </preConditions>  
		 <sql dbms="mariadb"
		      endDelimiter=";"
		      splitStatements="true"
		      stripComments="true">
		    INSERT INTO PDPSTATISTICS 
		    (ID, NAME, VERSION, PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, 
		    POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, 
		    POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP) 
		    VALUES  (3, 'TestName', '1.0.0', 'TestGroup', 'TestSubGroup', 1, 1, 1, 1, 1, 1, now()) 
		 </sql> 
		 <rollback>
		   DELETE FROM PDPSTATISTICS WHERE ID=3
		</rollback>
    </changeSet>  
 </databaseChangeLog>


Add pom.xml

pom.xml
 <project  xmlns="http://maven.apache.org/POM/4.0.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
   <modelVersion>4.0.0</modelVersion>  
 
   <groupId>com.liquibase.mariadb.app</groupId>  
   <artifactId>LiquibaseMariadbp</artifactId>  
   <version>1.0-SNAPSHOT</version>  
   <build>  
       <pluginManagement>  
           <plugins>  
               <plugin>  
                   <groupId>org.liquibase</groupId>  
                   <artifactId>liquibase-maven-plugin</artifactId>  
                   <version>3.8.0</version>  
                   <configuration>  
                       <propertyFile>liquibase.properties</propertyFile>  
                   </configuration>  
                   <dependencies>  
					<dependency>
					    <groupId>org.mariadb.jdbc</groupId>
					    <artifactId>mariadb-java-client</artifactId>
					    <version>2.7.3</version>
					</dependency>					
				   <dependency>  
                       <groupId>org.hibernate</groupId>  
                       <artifactId>hibernate-core</artifactId>  
                       <version>5.4.6.Final</version>  
                   </dependency>  
                 </dependencies>  
               </plugin>  
           </plugins>  
       </pluginManagement>  
   </build>  
 </project>

Test 1: Update database with changeLog in XML format

From the command line in the project directory

mvn package

mvn liquibase:update

Check you database, a new record has been added to pdpstatistics

[INFO] SELECT * FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
[INFO] SELECT count(1) FROM information_schema.tables
WHERE table_name = 'PDPSTATISTICS'
[INFO] INSERT INTO PDPSTATISTICS
(ID, NAME, VERSION, PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT,
POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT,
POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP)
VALUES (3, 'TestName', '1.0.0', 'TestGroup', 'TestSubGroup', 1, 1, 1, 1, 1, 1, now())
[INFO] Custom SQL executed
[INFO] ChangeSet dbchangelog.xml::policy-1::policy ran successfully in 7ms

Test 2: Rollback update

mvn liquibase:rollback -Dliquibase.rollbackCount=1

new record has been removed has been dropped

[INFO] SELECT * FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
[INFO] Rolling Back Changeset:dbchangelog.xml::policy-1::policy
[INFO] DELETE FROM PDPSTATISTICS WHERE ID=3
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = 'policy-1' AND AUTHOR = 'policy' AND FILENAME = 'dbchangelog.xml'

Test 3: Generate database dump chageLog in YAML format

Add the following 2 lines to liquibase.properties

outputChangeLogFile: dbchangelog.mariadb.yaml
diffTypes: catalog,tables,views,columns,indexes,foreignkeys,primarykeys,uniqueconstraints,data,storedprocedure


mvn liquibase:generateChangeLog

The file dbchangelog.mariadb.yaml will contain the DDL for your database in YAML format

Test 4: Generate database dump chageLog in SQL format

change outputChangeLogFile: dbchangelog.mariadb.yaml to outputChangeLogFile: dbchangelog.mariadb.sql

The file dbchangelog.mariadb.sql will contain the DDL for your database in SQL format

Test 5: Update database with changeLog in YAML format

Add dbchangelog.yaml

dbchangelog.yaml
databaseChangeLog:

  -  changeSet:
      id:  policy-2
      author:  admin
      changes:
        -  createTable:
            tableName:  JpaPdpPolicyDeploymentAudit
            columns:
              -  column:
                  name:  id
                  type:  int
                  autoIncrement:  true
                  constraints:
                    primaryKey:  true
                    nullable:  false
              -  column:
                  constraints:
                    primaryKey:  true
                    nullable:  false
                  name:  name
                  type:  varchar(120)
              -  column:
                  name:  version
                  type:  varchar(20)
                  constraints:
                    primaryKey:  true
                    nullable:  false
              -  column:
                  name:  pdpGroup
                  type:  varchar(255)
                  constraints:
                    nullable:  true
              -  column:
                  name:  pdpType
                  type:  varchar(255)
                  constraints:
                    nullable:  true    
              -  column:
                  name:  action
                  type:  int
                  constraints:
                    nullable:  true  
              -  column:
                  name:  timeStamp
                  type:  datetime
                  constraints:
                    nullable:  true                       

  -  changeSet:
      id:  policy-3
      author:  admin
      changes:
        -  addColumn:
            tableName:  JpaPdpPolicyDeploymentAudit
            columns:
              -  column:
                  name:  changedByUser
                  type:  varchar(255)
                  constraints:
                    nullable:  true 


Add a new plugin dependency to pom.xml

<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.28</version>
</dependency>


mvn package

mvn liquibase:update

2 new entries in the databasechangelog table

databasechangelog
select * from databasechangelog;
+----+--------+------------------+---------------------+---------------+----------+------------------------------------+---------------------------------------------------------------------------------------------------------+----------+------+-----------+----------+--------+---------------+
| ID | AUTHOR | FILENAME         | DATEEXECUTED        | ORDEREXECUTED | EXECTYPE | MD5SUM                             | DESCRIPTION                                                                                             | COMMENTS | TAG  | LIQUIBASE | CONTEXTS | LABELS | DEPLOYMENT_ID |
+----+--------+------------------+---------------------+---------------+----------+------------------------------------+---------------------------------------------------------------------------------------------------------+----------+------+-----------+----------+--------+---------------+
| policy-2   | admin  | dbchangelog.yaml               | 2021-05-24 15:04:49 |            10 | EXECUTED | 8:f5bd9cec4e2374254cc1985e8e9bfaae | createTable tableName=JpaPdpPolicyDeploymentAudit |          | NULL | 3.8.0     | NULL     | NULL       | 1865089400    |
| policy-3   | admin  | dbchangelog.yaml               | 2021-05-24 15:04:49 |            11 | EXECUTED | 8:4c9ec93973102be9b6d966cf6bc724b4 | addColumn tableName=JpaPdpPolicyDeploymentAudit   |          | NULL | 3.8.0     | NULL     | NULL       | 1865089400    |
+----+--------+------------------+---------------------+---------------+----------+------------------------------------+---------------------------------------------------------------------------------------------------------+----------+------+-----------+----------+--------+---------------+

Test 6: Rollback last update

mvn liquibase:rollback -Dliquibase.rollbackCount=1

[INFO] SELECT * FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
[INFO] Rolling Back Changeset:dbchangelog.yaml::policy-3::admin
[INFO] ALTER TABLE JpaPdpPolicyDeploymentAudit DROP COLUMN changedByUser
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = 'policy-3' AND AUTHOR = 'admin' AND FILENAME = 'dbchangelog.yaml'

Test 7: Rollback last update

mvn liquibase:rollback -Dliquibase.rollbackCount=1

[INFO] Rolling Back Changeset:dbchangelog.yaml::policy-2::admin
[INFO] DROP TABLE JpaPdpPolicyDeploymentAudit
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = 'policy-2' AND AUTHOR = 'admin' AND FILENAME = 'dbchangelog.yaml'

Test 8: Update database with changeLog in YAML format which includes raw SQL

Add dbchangelog-sql.yaml

dbchangelog-sql.yaml
 databaseChangeLog:
  -  changeSet:  
       id:  policy-4 
       author:  admin  
       changes:  
        -  sql:  
            comment:  create JpaPdpPolicyDeploymentAudit table  
            dbms:  '!h2,  oracle,  mysql, mariadb'  
            endDelimiter:  \nGO  
            splitStatements:  true  
            sql:  CREATE TABLE JpaPdpPolicyDeploymentAudit (
                                 ID BIGINT NOT NULL, 
                                 NAME VARCHAR(120) NOT NULL, 
                                 VERSION VARCHAR(20) NOT NULL,
                                 PDPGROUP VARCHAR(255) DEFAULT NULL NULL,
                                 PDPTYPE VARCHAR(255) DEFAULT NULL NULL,
                                 ACTION BIGINT DEFAULT NULL NULL, 
                                 TIMESTAMP datetime DEFAULT NULL NULL,  
                                 CHANGEDBYUSER VARCHAR(255) DEFAULT NULL NULL,
                   CONSTRAINT PK_PDPSTATISTICS PRIMARY KEY (ID, NAME, VERSION)
                   );             
            stripComments:  true
  -  changeSet:  
       id:  policy-5
       author:  admin  
       changes:  
        -  sql:  
            comment:  insert JpaPdpPolicyDeploymentAudit 
            dbms:  '!h2,  oracle,  mysql, mariadb'  
            endDelimiter:  \nGO  
            splitStatements:  true  
            sql:  insert into JpaPdpPolicyDeploymentAudit 
                  (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) 
                  values 
                  (1, 'TestName', '1.0.0', 'TestGroup', 'TestType', 1, now(), 'Admin')  
            stripComments:  true                       


update liquibase.properties

changeLogFile: dbchangelog-sql.yaml


mvn liquibase:update

A new table called JpaPdpPolicyDeploymentAudit with one entry has been added to the database

Test 9: Rollback 2 previous updates

Run mvn liquibase:rollback -Dliquibase.rollbackCount=2

[INFO] Rolling Back Changeset:dbchangelog-sql.yaml::policy-5::admin
[INFO] delete from JpaPdpPolicyDeploymentAudit where id = 1
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = 'policy-5' AND AUTHOR = 'admin' AND FILENAME = 'dbchangelog-sql.yaml'
[INFO] Rolling Back Changeset:dbchangelog-sql.yaml::policy-4::admin
[INFO] drop table JpaPdpPolicyDeploymentAudit
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = 'policy-4' AND AUTHOR = 'admin' AND FILENAME = 'dbchangelog-sql.yaml'

Test 10: Update database with changeLog in YAML format which calls 2 embedded SQL changeLogs

Add JpaPdpPolicyDeploymentAudit-changelog-1.sql

JpaPdpPolicyDeploymentAudit-changelog-1.sql
--liquibase formatted sql
	
--changeset admin:policy-6		
CREATE TABLE JpaPdpPolicyDeploymentAudit (
                                 ID BIGINT NOT NULL, 
                                 NAME VARCHAR(120) NOT NULL, 
                                 VERSION VARCHAR(20) NOT NULL,
                                 PDPGROUP VARCHAR(255) DEFAULT NULL NULL,
                                 PDPTYPE VARCHAR(255) DEFAULT NULL NULL,
                                 ACTION BIGINT DEFAULT NULL NULL, 
                                 TIMESTAMP datetime DEFAULT NULL NULL,  
                                 CHANGEDBYUSER VARCHAR(255) DEFAULT NULL NULL,
                   CONSTRAINT PK_PDPSTATISTICS PRIMARY KEY (ID, NAME, VERSION)
                   );

-- rollback drop table JpaPdpPolicyDeploymentAudit

Add JpaPdpPolicyDeploymentAudit-changelog-2.sql

JpaPdpPolicyDeploymentAudit-changelog-2.sql
--liquibase formatted sql
			
--changeset admin:policy-7
insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values (1, 'TestName', '1.0.0', 'TestGroup', 'TestType', 1, now(), 'Admin');
insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values (2, 'TestName2', '1.0.0', 'TestGroup2', 'TestType2', 1, now(), 'Admin');

-- rollback delete from JpaPdpPolicyDeploymentAudit where id in(1,2);

Add dbchangelog-master.yaml

dbchangelog-master.yaml
databaseChangeLog:
- include:
    file:  JpaPdpPolicyDeploymentAudit-changelog-1.sql  
- include:
    file:  JpaPdpPolicyDeploymentAudit-changelog-2.sql  

Update liquibase.properties →  changeLogFile: dbchangelog-master.yaml

Run mvn liquibase:update

[INFO] CREATE TABLE JpaPdpPolicyDeploymentAudit (
ID BIGINT NOT NULL,
NAME VARCHAR(120) NOT NULL,
VERSION VARCHAR(20) NOT NULL,
PDPGROUP VARCHAR(255) DEFAULT NULL NULL,
PDPTYPE VARCHAR(255) DEFAULT NULL NULL,
ACTION BIGINT DEFAULT NULL NULL,
TIMESTAMP datetime DEFAULT NULL NULL,
CHANGEDBYUSER VARCHAR(255) DEFAULT NULL NULL,
CONSTRAINT PK_PDPSTATISTICS PRIMARY KEY (ID, NAME, VERSION)
)
[INFO] Custom SQL executed
[INFO] ChangeSet JpaPdpPolicyDeploymentAudit-changelog-1.sql::policy-6::admin ran successfully in 329ms
[INFO] SELECT MAX(ORDEREXECUTED) FROM DATABASECHANGELOG
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('policy-6', 'admin', 'JpaPdpPolicyDeploymentAudit-changelog-1.sql', NOW(), 13, '8:c5d0bc1cbc6a6875136d754002802e6f', 'sql', '', 'EXECUTED', NULL, NULL, '3.8.0', '1868752479')
[INFO] insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values (1, 'TestName', '1.0.0', 'TestGroup', 'TestType', 1, now(), 'Admin')
[INFO] insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values (2, 'TestName2', '1.0.0', 'TestGroup2', 'TestType2', 1, now(), 'Admin')
[INFO] Custom SQL executed
[INFO] ChangeSet JpaPdpPolicyDeploymentAudit-changelog-2.sql::policy-7::admin ran successfully in 15ms
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('policy-7', 'admin', 'JpaPdpPolicyDeploymentAudit-changelog-2.sql', NOW(), 14, '8:5b683eb6e17f177268ed50b9d2829bda', 'sql', '', 'EXECUTED', NULL, NULL, '3.8.0', '1868752479')

The a new table called customer has been created and 2 records have been inserted.

Note: When using raw SQL you must provide the rollback statements in order to revert the database to it's previous state


Test 11: Update database with changeLog in YAML format which includes raw SQL and tags

Add Add dbchangelog-sql2.yaml

dbchangelog-sql.yaml
databaseChangeLog:
-  changeSet:  
     id:  policy-8
     author:  admin  
     changes:  
     - tagDatabase:  
        tag:  1.0    
     -  sql:  
         comment:  insert JpaPdpPolicyDeploymentAudit
         dbms:  '!h2,  oracle,  mysql, mariadb'  
         endDelimiter:  \nGO  
         splitStatements:  true  
         sql:  insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) 
               values (3, 'TestName3', '1.0.0', 'TestGroup3', 'TestType3', 1, now(), 'Admin')  
         stripComments:  true            
     rollback:    
     - sql:
         sql: delete from JpaPdpPolicyDeploymentAudit where id = 3;    
-  changeSet:  
     id:  policy-9
     author:  admin  
     changes:  
     - tagDatabase:  
        tag:  1.1   
     -  sql:  
         comment:  insert JpaPdpPolicyDeploymentAudit
         dbms:  '!h2,  oracle,  mysql, mariadb'  
         endDelimiter:  \nGO  
         splitStatements:  true  
         sql:  insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) 
               values (4, 'TestName4', '1.0.0', 'TestGroup4', 'TestType4', 1, now(), 'Admin')  
         stripComments:  true            
     rollback:    
     - sql:
         sql: delete from JpaPdpPolicyDeploymentAudit where id = 4;                  


Update liquibase.properties →  changeLogFile: dbchangelog-sql2.yaml

Run mvn:liquibase update

[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID, TAG) VALUES ('policy-8', 'admin', 'dbchangelog-sql2.yaml', NOW(), 15, '8:f83378476fe49386b479e3bdaf33c8f0', 'tagDatabase; sql', '', 'EXECUTED', NULL, NULL, '3.8.0', '1869831922', '1.0')
[INFO] Tag '1.1' applied to database
[INFO] insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values (4, 'TestName4', '1.0.0', 'TestGroup4', 'TestType4', 1, now(), 'Admin')
[INFO] Custom SQL executed
[INFO] ChangeSet dbchangelog-sql2.yaml::policy-9::admin ran successfully in 4ms
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID, TAG) VALUES ('policy-9', 'admin', 'dbchangelog-sql2.yaml', NOW(), 16, '8:3012add458c8a5395af9f2797779af1e', 'tagDatabase; sql', '', 'EXECUTED', NULL, NULL, '3.8.0', '1869831922', '1.1')

2 new records have been added to the JpaPdpPolicyDeploymentAudit table

Test 12: Rollback update using tag

mvn liquibase:rollback -Dliquibase.rollbackTag=1.0

[INFO] Rolling Back Changeset:dbchangelog-sql2.yaml::policy-9::admin
[INFO] delete from JpaPdpPolicyDeploymentAudit where id = 4
[INFO] DELETE FROM DATABASECHANGELOG WHERE ID = 'policy-9' AND AUTHOR = 'admin' AND FILENAME = 'dbchangelog-sql2.yaml'

Last insert has been deleted


Test 13: Re-run last update

mvn liquibase:update

[INFO] Tag '1.1' applied to database
[INFO] insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values (4, 'TestName4', '1.0.0', 'TestGroup4', 'TestType4', 1, now(), 'Admin')
[INFO] Custom SQL executed
[INFO] ChangeSet dbchangelog-sql2.yaml::policy-9::admin ran successfully in 7ms
[INFO] SELECT MAX(ORDEREXECUTED) FROM DATABASECHANGELOG
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, 

Only the second insert statement ran.


Test 14: Add labels to changeSets

Add dbchangelog-sql3.yaml

dbchangelog-sql2.yaml
databaseChangeLog:
-  changeSet:  
     id:  policy-10
     author:  admin 
     labels: release1.0
     changes:  
     - tagDatabase:  
        tag:  1.2   
     -  sql:  
         comment:  insert JpaPdpPolicyDeploymentAudit 
         dbms:  '!h2,  oracle,  mysql, mariadb'  
         endDelimiter:  \nGO  
         splitStatements:  true  
         sql:  insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) 
               values (5, 'TestName5', '1.0.0', 'TestGroup5', 'TestType5', 1, now(), 'Admin')   
         stripComments:  true            
     rollback:    
     - sql:
         sql: delete from JpaPdpPolicyDeploymentAudit where id = 5;    
-  changeSet:  
     id:  polict-11
     author:  admin  
     labels: release1.1
     changes:  
     - tagDatabase:  
        tag:  1.3    
     -  sql:  
         comment:  insert JpaPdpPolicyDeploymentAudit 
         dbms:  '!h2,  oracle,  mysql, mariadb'  
         endDelimiter:  \nGO  
         splitStatements:  true  
         sql:  insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) 
               values (6, 'TestName6', '1.0.0', 'TestGroup6', 'TestType6', 1, now(), 'Admin')  
         stripComments:  true            
     rollback:    
     - sql:
         sql: delete from JpaPdpPolicyDeploymentAudit where id = 6;                                   


Run mvn liquibase:update -Dliquibase.labels=release1.0

[INFO] Tag '1.2' applied to database
[INFO] insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values (5, 'TestName5', '1.0.0', 'TestGroup5', 'TestType5', 1, now(), 'Admin')
[INFO] Custom SQL executed
[INFO] ChangeSet dbchangelog-sql3.yaml::policy-10::admin ran successfully in 5ms
[INFO] SELECT MAX(ORDEREXECUTED) FROM DATABASECHANGELOG
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID, TAG) VALUES ('policy-10', 'admin', 'dbchangelog-sql3.yaml', NOW(), 17, '8:71e4400a0bf77f08304ea92c3a989657', 'tagDatabase; sql', '', 'EXECUTED', NULL, 'release1.0', '3.8.0', '1870546128', '1.2')

Only changeSet with label release1.0 has been applied


Test 15: Apply second label

Run mvn liquibase:update -Dliquibase.labels=release1.0,release1.1


[INFO] Tag '1.3' applied to database
[INFO] insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values (6, 'TestName6', '1.0.0', 'TestGroup6', 'TestType6', 1, now(), 'Admin')
[INFO] Custom SQL executed
[INFO] ChangeSet dbchangelog-sql3.yaml::polict-11::admin ran successfully in 6ms
[INFO] SELECT MAX(ORDEREXECUTED) FROM DATABASECHANGELOG
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID, TAG) VALUES ('polict-11', 'admin', 'dbchangelog-sql3.yaml', NOW(), 18, '8:cab3ec22e42eb1be367a62d0a86c80dc', 'tagDatabase; sql', '', 'EXECUTED', NULL, 'release1.1', '3.8.0', '1870657144', '1.3')


ChangeSet with label release1.1 has been applied


Test 16: Test contexts

Add dbchangelog-sql4.yaml

dbchangelog-sql4.yaml
databaseChangeLog:
-  changeSet:  
     id:  policy-12
     author:  admin 
     context: qa
     labels: release1.2
     changes:  
     - tagDatabase:  
        tag:  1.4 
     -  sql:  
         comment:  insert JpaPdpPolicyDeploymentAudit 
         dbms:  '!h2,  oracle,  mysql, mariadb'  
         endDelimiter:  \nGO  
         splitStatements:  true  
         sql:  insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) 
               values (7, 'TestName', '1.0.0', 'TestGroup', 'TestType', 1, now(), 'Admin')  
         stripComments:  true            
     rollback:    
     - sql:
         sql: delete from JpaPdpPolicyDeploymentAudit where id = 7;    
-  changeSet:  
     id:  policy-13
     author:  admin  
     context: test   
     labels: release1.2
     changes:  
     - tagDatabase:  
        tag:  1.9    
     -  sql:  
         comment:  insert JpaPdpPolicyDeploymentAudit 
         dbms:  '!h2,  oracle,  mysql, mariadb'  
         endDelimiter:  \nGO  
         splitStatements:  true  
         sql:  insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) 
               values (8, 'TestName', '1.0.0', 'TestGroup', 'TestType', 1, now(), 'Admin')   
         stripComments:  true            
     rollback:    
     - sql:
         sql: delete from JpaPdpPolicyDeploymentAudit where id = 8;                                 

Run mvn liquibase:update -Dliquibase.contexts=test

[INFO] Tag '1.9' applied to database
[INFO] insert into JpaPdpPolicyDeploymentAudit (id, name, version, pdpGroup, PdpType, action, timeStamp, changedByUser) values (8, 'TestName', '1.0.0', 'TestGroup', 'TestType', 1, now(), 'Admin')
[INFO] Custom SQL executed
[INFO] ChangeSet dbchangelog-sql4.yaml::policy-13::admin ran successfully in 6ms
[INFO] SELECT MAX(ORDEREXECUTED) FROM DATABASECHANGELOG
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID, TAG) VALUES ('policy-13', 'admin', 'dbchangelog-sql4.yaml', NOW(), 19, '8:2c2fb879e12ca3547180d53dbe43c53a', 'tagDatabase; sql', '', 'EXECUTED', 'test', 'release1.2', '3.8.0', '1871103966', '1.9')

Only the changeSet with context test has run


To see more about contexts and labels please visit: Understanding Contexts vs. Labels

Test 17: Test YAML changelog

Add dbchangelog-sql5.yaml


dbchangelog-sql5.yaml
databaseChangeLog:
  -  changeSet:  
       id:  policy-14 
       author:  admin  
       label: release1.2
       preConditions:
         - onFail: MARK_RAN
         - not:
           - tableExists:
               tableName: pdpstatistics
       changes:
       - tagDatabase:  
          tag:  20         
  - createTable:
      columns:
      - column:
          name: PDPGROUPNAME
          type: VARCHAR(120)
      - column:
          name: PDPSUBGROUPNAME
          type: VARCHAR(120)
      - column:
          defaultValueComputed: 'NULL'
          name: POLICYDEPLOYCOUNT
          type: BIGINT
      - column:
          defaultValueComputed: 'NULL'
          name: POLICYDEPLOYFAILCOUNT
          type: BIGINT
      - column:
          defaultValueComputed: 'NULL'
          name: POLICYDEPLOYSUCCESSCOUNT
          type: BIGINT
      - column:
          defaultValueComputed: 'NULL'
          name: POLICYEXECUTEDCOUNT
          type: BIGINT
      - column:
          defaultValueComputed: 'NULL'
          name: POLICYEXECUTEDFAILCOUNT
          type: BIGINT
      - column:
          defaultValueComputed: 'NULL'
          name: POLICYEXECUTEDSUCCESSCOUNT
          type: BIGINT
      - column:
          defaultValueComputed: 'NULL'
          name: TIMESTAMP
          type: datetime
      - column:
          constraints:
            primaryKey: true
          name: ID
          type: BIGINT
      - column:
          constraints:
            primaryKey: true
          name: name
          type: VARCHAR(120)
      - column:
          constraints:
            primaryKey: true
          name: version
          type: VARCHAR(20)
      tableName: pdpstatistics  
      
  -  changeSet:  
       id:  policy-15
       author:  admin  
       label: release1.2
       changes:
       - tagDatabase:  
          tag:  21         
       - insert:
            columns:
            - column:
                name: PDPGROUPNAME
                value: group
            - column:
                name: PDPSUBGROUPNAME
                value: subgroup
            - column:
                name: POLICYDEPLOYCOUNT
                valueNumeric: 2
            - column:
                name: POLICYDEPLOYFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYDEPLOYSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDCOUNT
                valueNumeric: 2
            - column:
                name: POLICYEXECUTEDFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: TIMESTAMP
                valueDate: NOW()
            - column:
                name: ID
                valueNumeric: 3
            - column:
                name: name
                value: name2
            - column:
                name: version
                value: 0.0.0
            tableName: pdpstatistics
       - insert:
            columns:
            - column:
                name: PDPGROUPNAME
                value: group
            - column:
                name: PDPSUBGROUPNAME
                value: subgroup
            - column:
                name: POLICYDEPLOYCOUNT
                valueNumeric: 2
            - column:
                name: POLICYDEPLOYFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYDEPLOYSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDCOUNT
                valueNumeric: 2
            - column:
                name: POLICYEXECUTEDFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: TIMESTAMP
                valueDate: NOW()
            - column:
                name: ID
                valueNumeric: 4
            - column:
                name: name
                value: name2
            - column:
                name: version
                value: 0.0.0
            tableName: pdpstatistics
       - insert:
            columns:
            - column:
                name: PDPGROUPNAME
                value: group
            - column:
                name: PDPSUBGROUPNAME
                value: subgroup
            - column:
                name: POLICYDEPLOYCOUNT
                valueNumeric: 2
            - column:
                name: POLICYDEPLOYFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYDEPLOYSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDCOUNT
                valueNumeric: 2
            - column:
                name: POLICYEXECUTEDFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: TIMESTAMP
                valueDate: NOW()
            - column:
                name: ID
                valueNumeric: 5
            - column:
                name: name
                value: name2
            - column:
                name: version
                value: 0.0.0
            tableName: pdpstatistics
       - insert:
            columns:
            - column:
                name: PDPGROUPNAME
                value: group
            - column:
                name: PDPSUBGROUPNAME
                value: subgroup
            - column:
                name: POLICYDEPLOYCOUNT
                valueNumeric: 2
            - column:
                name: POLICYDEPLOYFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYDEPLOYSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDCOUNT
                valueNumeric: 2
            - column:
                name: POLICYEXECUTEDFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: TIMESTAMP
                valueDate: NOW()
            - column:
                name: ID
                valueNumeric: 6
            - column:
                name: name
                value: name2
            - column:
                name: version
                value: 0.0.0
            tableName: pdpstatistics
       - insert:
            columns:
            - column:
                name: PDPGROUPNAME
                value: group
            - column:
                name: PDPSUBGROUPNAME
                value: subgroup
            - column:
                name: POLICYDEPLOYCOUNT
                valueNumeric: 2
            - column:
                name: POLICYDEPLOYFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYDEPLOYSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDCOUNT
                valueNumeric: 2
            - column:
                name: POLICYEXECUTEDFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: TIMESTAMP
                valueDate: NOW()
            - column:
                name: ID
                valueNumeric: 7
            - column:
                name: name
                value: name2
            - column:
                name: version
                value: 0.0.0
            tableName: pdpstatistics
       - insert:
            columns:
            - column:
                name: PDPGROUPNAME
                value: group
            - column:
                name: PDPSUBGROUPNAME
                value: subgroup
            - column:
                name: POLICYDEPLOYCOUNT
                valueNumeric: 2
            - column:
                name: POLICYDEPLOYFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYDEPLOYSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDCOUNT
                valueNumeric: 2
            - column:
                name: POLICYEXECUTEDFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: TIMESTAMP
                valueDate: NOW()
            - column:
                name: ID
                valueNumeric: 8
            - column:
                name: name
                value: name2
            - column:
                name: version
                value: 0.0.0
            tableName: pdpstatistics
       - insert:
            columns:
            - column:
                name: PDPGROUPNAME
                value: group
            - column:
                name: PDPSUBGROUPNAME
                value: subgroup
            - column:
                name: POLICYDEPLOYCOUNT
                valueNumeric: 2
            - column:
                name: POLICYDEPLOYFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYDEPLOYSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDCOUNT
                valueNumeric: 2
            - column:
                name: POLICYEXECUTEDFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: TIMESTAMP
                valueDate: NOW()
            - column:
                name: ID
                valueNumeric: 9
            - column:
                name: name
                value: name2
            - column:
                name: version
                value: 0.0.0
            tableName: pdpstatistics
       - insert:
            columns:
            - column:
                name: PDPGROUPNAME
                value: group
            - column:
                name: PDPSUBGROUPNAME
                value: subgroup
            - column:
                name: POLICYDEPLOYCOUNT
                valueNumeric: 2
            - column:
                name: POLICYDEPLOYFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYDEPLOYSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDCOUNT
                valueNumeric: 2
            - column:
                name: POLICYEXECUTEDFAILCOUNT
                valueNumeric: 1
            - column:
                name: POLICYEXECUTEDSUCCESSCOUNT
                valueNumeric: 1
            - column:
                name: TIMESTAMP
                valueDate: NOW()
            - column:
                name: ID
                valueNumeric: 10
            - column:
                name: name
                value: name2
            - column:
                name: version
                value: 0.0.0
            tableName: pdpstatistics

Update liquibase.properties to point to dbchangelog-sql5.yaml

Run mvn liquibase:update


[INFO] Marking ChangeSet: dbchangelog-sql5.yaml::policy-14::admin ran despite precondition failure due to onFail='MARK_RAN':
dbchangelog-sql5.yaml : Not precondition failed

[INFO] SELECT MAX(ORDEREXECUTED) FROM DATABASECHANGELOG
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID, TAG) VALUES ('policy-14', 'admin', 'dbchangelog-sql5.yaml', NOW(), 20, '8:09312d85176b6fb93520e5d8f9702e96', 'tagDatabase', '', 'MARK_RAN', NULL, NULL, '3.8.0', '1931263740', '20')
[INFO] Tag '21' applied to database
[INFO] INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 3, 'name2', '0.0.0')
[INFO] New row inserted into pdpstatistics
[INFO] INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 4, 'name2', '0.0.0')
[INFO] New row inserted into pdpstatistics
[INFO] INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 5, 'name2', '0.0.0')
[INFO] New row inserted into pdpstatistics
[INFO] INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 6, 'name2', '0.0.0')
[INFO] New row inserted into pdpstatistics
[INFO] INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 7, 'name2', '0.0.0')
[INFO] New row inserted into pdpstatistics
[INFO] INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 8, 'name2', '0.0.0')
[INFO] New row inserted into pdpstatistics
[INFO] INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 9, 'name2', '0.0.0')
[INFO] New row inserted into pdpstatistics
[INFO] INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 10, 'name2', '0.0.0')
[INFO] New row inserted into pdpstatistics
[INFO] ChangeSet dbchangelog-sql5.yaml::policy-15::admin ran successfully in 21ms
[INFO] INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID, TAG) VALUES ('policy-15', 'admin', 'dbchangelog-sql5.yaml', NOW(), 21, '8:70aa4c084fd72dba46a76ce8fe5b5732', 'tagDatabase; insert tableName=pdpstatistics; insert tableName=pdpstatistics; insert tableName=pdpstatistics; insert tableName=pdpstatistics; insert tableName=pdpstatistics; insert tableName=pdpstatistics; insert tableName=pdpstatistics; insert tab...', '', 'EXECUTED', NULL, NULL, '3.8.0', '1931263740', '21')


mvn liquibase:rollback -Dliquibase.rollbackCount=2


[INFO] Rolling Back Changeset:dbchangelog-sql5.yaml::policy-15::admin
[INFO] Successfully released change log lock
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.454 s
[INFO] Finished at: 2021-05-25T09:33:29+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.8.0:rollback (default-cli) on project LiquibaseMariadbp: Error setting up or running Liquibase: liquibase.exception.RollbackImpossibleException: No inverse to liquibase.change.core.InsertDataChange created -> [Help 1]


Cannot rollback.


Test 18: Test YAML changelog with embedded SQL

Add dbchangelog-sql6.yaml


dbchangelog-sql6.yaml
databaseChangeLog:
  -  changeSet:  
       id:  policy-16
       author:  admin  
       label: release1.2
       preConditions:
         - onFail: MARK_RAN
         - not:
           - tableExists:
               tableName: pdpstatistics
       changes:
       - tagDatabase:  
          tag:  22        
       -  sql:  
           comment:  create pdpstatistics 
           dbms:  '!h2,  oracle,  mysql, mariadb'  
           endDelimiter:  \nGO  
           splitStatements:  true  
           sql:  CREATE TABLE pdpstatistics (
                              PDPGROUPNAME VARCHAR(120) NULL, 
                              PDPSUBGROUPNAME VARCHAR(120) NULL, 
                              POLICYDEPLOYCOUNT BIGINT DEFAULT NULL NULL, 
                              POLICYDEPLOYFAILCOUNT BIGINT DEFAULT NULL NULL, 
                              POLICYDEPLOYSUCCESSCOUNT BIGINT DEFAULT NULL NULL, 
                              POLICYEXECUTEDCOUNT BIGINT DEFAULT NULL NULL, 
                              POLICYEXECUTEDFAILCOUNT BIGINT DEFAULT NULL NULL, 
                              POLICYEXECUTEDSUCCESSCOUNT BIGINT DEFAULT NULL NULL, 
                              TIMESTAMP datetime DEFAULT NULL NULL, 
                              ID BIGINT NOT NULL, 
                              name VARCHAR(120) NOT NULL, 
                              version VARCHAR(20) NOT NULL, 
                              CONSTRAINT PK_PDPSTATISTICS PRIMARY KEY (ID, name, version));  
           stripComments:  true            
  -  changeSet:  
       id:  policy-17 
       author:  admin  
       label: release1.2
       preConditions:
         - onFail: MARK_RAN
         - tableExists:
             tableName: pdpstatistics
       changes:
       - tagDatabase:  
          tag:  23        
       -  sql:  
           comment:  insert pdpstatistics 
           dbms:  '!h2,  oracle,  mysql, mariadb'  
           endDelimiter:  \nGO  
           splitStatements:  true  
           stripComments:  true    
           sql:  INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 11, 'name2', '0.0.0');
       -  sql:  
           comment:  insert pdpstatistics 
           dbms:  '!h2,  oracle,  mysql, mariadb'  
           endDelimiter:  \nGO  
           splitStatements:  true  
           stripComments:  true    
           sql:  INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 12, 'name2', '0.0.0');   
       -  sql:  
           comment:  insert pdpstatistics 
           dbms:  '!h2,  oracle,  mysql, mariadb'  
           endDelimiter:  \nGO  
           splitStatements:  true  
           stripComments:  true    
           sql:  INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 13, 'name2', '0.0.0');
       -  sql:  
           comment:  insert pdpstatistics 
           dbms:  '!h2,  oracle,  mysql, mariadb'  
           endDelimiter:  \nGO  
           splitStatements:  true  
           stripComments:  true    
           sql:  INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 14, 'name2', '0.0.0');
       -  sql:  
           comment:  insert pdpstatistics 
           dbms:  '!h2,  oracle,  mysql, mariadb'  
           endDelimiter:  \nGO  
           splitStatements:  true  
           stripComments:  true    
           sql:  INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 15, 'name2', '0.0.0');
       -  sql:  
           comment:  insert pdpstatistics 
           dbms:  '!h2,  oracle,  mysql, mariadb'  
           endDelimiter:  \nGO  
           splitStatements:  true  
           stripComments:  true    
           sql:  INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 16, 'name2', '0.0.0');
       -  sql:  
           comment:  insert pdpstatistics 
           dbms:  '!h2,  oracle,  mysql, mariadb'  
           endDelimiter:  \nGO  
           splitStatements:  true  
           stripComments:  true    
           sql:  INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2, 1, 1, 2, 1, 1, NOW(), 17, 'name2', '0.0.0');
       -  sql:  
           comment:  insert pdpstatistics 
           dbms:  '!h2,  oracle,  mysql, mariadb'  
           endDelimiter:  \nGO  
           splitStatements:  true  
           stripComments:  true    
           sql:  INSERT INTO pdpstatistics (PDPGROUPNAME, PDPSUBGROUPNAME, POLICYDEPLOYCOUNT, POLICYDEPLOYFAILCOUNT, POLICYDEPLOYSUCCESSCOUNT, POLICYEXECUTEDCOUNT, POLICYEXECUTEDFAILCOUNT, POLICYEXECUTEDSUCCESSCOUNT, TIMESTAMP, ID, name, version) VALUES ('group', 'subgroup', 2