Versions Compared

Key

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

Steps to test liquibase change log

...

  • liquibase.rollbackCount - reverts a specified number of changesets sequentially, starting with the most recent changes and working backward until the value specified is reached :

    • Code Block
      mvn clean compile org.liquibase:liquibase-maven-plugin:3.8.7:rollback -Dliquibase.url=jdbc:postgresql://localhost:5432/cpsdb -Dliquibase.username=cps -Dliquibase.password=cps -Dliquibase.changeLogFile=changelog/changelog-master.yaml -Dliquibase.rollbackCount=x


  • liquibase.rollbackTag - reverts all changes that were made to the database after the specified tag:

    • Code Block
      mvn clean compile org.liquibase:liquibase-maven-plugin:3.8.7:rollback -Dliquibase.url=jdbc:postgresql://localhost:5432/cpsdb -Dliquibase.username=cps -Dliquibase.password=cps -Dliquibase.changeLogFile=changelog/changelog-master.yaml -Dliquibase.rollbackTag=<liquibase_tag_for_changesets_to_be_rolled_back>


  • liquibase.rollbackDate - reverts all changes made to your database from today's date to the date and time you specify.

    • Code Block
      mvn clean compile org.liquibase:liquibase-maven-plugin:3.8.7:rollback -Dliquibase.url=jdbc:postgresql://localhost:5432/cpsdb -Dliquibase.username=cps -Dliquibase.password=cps -Dliquibase.changeLogFile=changelog/changelog-master.yaml -Dliquibase.rollbackDate=2020-11-26


See also DB Schema Changes (Liquibase Change Logs)

Steps to create checksum for yang-resource:

...

     NOTE: Remove all escape characters from file, check attached file for reference.


  • Code Block
    curl --location --request POST 'http://localhost:8883/cps/api/v1/dataspaces/NSODemo/schema-sets' \
    --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \
    --form 'file=@"****path-to-yang-file****"' \                      // insert your yang file path here
    --form 'schema-set-name="dmi-registry@2021-05-20.yang"'

    View file
    namedmi-registry.yang
    height250

4. login to postgres and check the entry in table to verify checksum


  • Code Block
    psql -h localhost -p 5432 -U cps -d cpsdb
    
    select * from yang_resource where name like '%dmi%'; //replace dmi with your names


Note about rollback

See:

* https://docs.liquibase.com/concepts/bestpractices.html in "Always think about rollback" section
* https://docs.liquibase.com/workflows/liquibase-community/using-rollback.html