How does one update a view with Liquibase on a Postgres database

  Kiến thức lập trình

I’m using Liquibase w/ a yaml changelog file. In my yaml I’m using something of the sort.

databaseChangeLog:
…
    - changeSet:
        id: unique-id-1
        author: unique-author
        - changes:
            - createView:
                schema_name: my_schema
                path: my_schema/views/vw_my_view.sql
                viewName: vw_my_view
                replaceIfExists: true

I run my liquibase update to create my view.

I then find I want to update my view (add columns, change columns, whatever), so I edit my original vw_my_view.sql.

When I go to create/append another changeset, liquibase flips out on me.

$ liquibase update
…
Starting Liquibase…
Liquibase Version: 4.27.0
Liquibase Open Source 4.27.0 by Liquibase
ERROR: Exception Details
ERROR: Exception Primary Class: ValidationFailedException
ERROR: Exception Primary Reason: Validation Failed:
    1 change sets check sum
        changelog/changelog-table.yml::unique-id-1::unique-author was 9:{{guid}} but is now 9:{{another guid}}

Do I need to generate a new .sql file for every view update? This kind of defeats the purpose of source controlling my original .sql file and the changelog.yml…doesn’t it?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT