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 Yan 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.

Loading data for Yang Resource

To load a yang resource, create a new yang resource csv file to load the data (as outlined above) in the following format 'yang_resource_@*date-of-creation*'

...

Code Block
languageyml
titleYang resource Change set example
collapsetrue
  - changeSet:
      author: cps
      label: dmi-registry-schema-preload
      id: 9.7
      loadUpdateData:
        encoding: UTF-8
        file: 'changelog/db/changes/data/dmi/yang_resource@2021-12-13.csv'
        onlyUpdate: 'false'
        primaryKey: 'id'
        quotchar: '"'
        separator: '|'
        tableName: 'yang_resource'
        columns:
          - column:
              header:  name
              name:  name
              type:  STRING
          - column:
              header:  content
              name: content
              type: STRING
          - column:
              header:  checksum
              name: checksum
              type: STRING
      rollback:
        - sql:
            sql: delete from yang_resource where name = 'dmi-registry@2021-12-13.yang'
Yang Resource Schema Set

Data will also need to be inserted into the yang_resource_schema_set table to create a mapping between the new yang resource and the necessary schema set.

...