Versions Compared

Key

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

...

Here the columns are also defined, along with the constraints of a specific column.

Anchor table example

...

Code Block
languageyml
titleAnchor Table Example
collapsetrue
databaseChangeLog:
  - changeSet:
      id: 1-1
      author: cps
      changes:
        - createTable:
            columns:
              - column:
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: anchor_pkey
                  name: id
                  type: BIGINT
              - column:
                  name: name
                  type: TEXT
              - column:
                  name: schema_set_id
                  type: INTEGER
              - column:
                  constraints:
                    nullable: false
                  name: dataspace_id
                  type: INTEGER
            tableName: anchor


To add a new table, under the latest change-set add a new change-set, incrementing the ID by one.Image Removed

Code Block
languageyml
titleAnchor Table Example
collapsetrue
- changeSet:
    id: 1-38
    author: cps


Define a changes object, all new edits will go under this section. Create a new createTable object, and under here the table name can be defined along with the column information/constraints as stated above.Image Removed

Code Block
languageyml
titleAnchor Table Example
collapsetrue
      changes:
        - createTable:
            columns:
              - column:
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: test_table_pkey
                  name: id
                  type: INTEGER
              - column:
                  constraints:
                    nullable: false
                  name: column_1
                  type: TEXT
            tableName: test_table


Table once created within SqlDeveloper

Adding/Editing Columns

Once the table is created, columns can be added and edited using a similar syntax to above.

To add foreign key constraints, within the 01-createCPSTables.yaml file create a new change-set and increment the change-set id as done above.



Insert Data


Adding New Yang Resource

...