Versions Compared

Key

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

...

Code Block
languageyml
titleLoad Data into Test Table
collapsetrue
databaseChangeLog:
  - changeSet:
      author: cps
      label: xnf-data-preload
      id: 14.1
      loadUpdateData:
        encoding: UTF-8
        file: 'changelog/db/changes/data/test_table.csv'
        onlyUpdate: 'false'
        primaryKey: 'id'
        quotchar: '"'
        separator: '|'
        tableName: 'test_table'


test table with data

Modifying CPS Client-Tables (Yang Modules)

Because of the generic way CPS stores any client data using Yang Modules often schema changes only affect these yang modules and the associated data not the actual Postgress DB schema!
The following sections describe how such changes could be implemented using Liquibase.

...

Code Block
languageyml
titleYang resource Change set example
collapsetrue
  - changeSet:
      author: cps
      label: dmi-registry-schema-preload
      id: 9.8
      loadUpdateData:
        encoding: UTF-8
        file: 'changelog/db/changes/data/dmi/schema_set_yang_resources@2021-12-13.csv'
        quotchar: '"'
        primaryKey: 'schema_set_id,yang_resource_id'
        separator: '|'
        tableName: 'schema_set_yang_resources'
        usePreparedStatements:  true
      rollback:
        - sql:
            sql: >
              delete from schema_set_yang_resources
              where schema_set_id = (select id from schema_set where name = 'ncmp-dmi-registry-model')
              and yang_resource_id = (select id from yang_resource where name = 'dmi-registry@2021-12-23.yang')

Rollback

As seen above, the rollback tag is included within the change-set in the case that and updates made need to be reverted.

...