Learn Database Migration With Postgresql and Java at Runtime

I. Problem

How to copy a PostgreSQL schema from one data source to another using Liquibase at run-time. The schema from the source data source might change using Liquibase Java client, so all the changes are logged in the table databasechangelog. Note that the original changeset file will become outdated at this point.

II. Solution

Outline

  1. Export the changelog from the source data source into a temporary file.
  2. Execute the temporary file (XML) that contains the changelog to the new data source.

Here's the code


0 Comments

Post a Comment

Post a Comment (0)

Previous Post Next Post
NERV Open Source

Building production Spring Boot systems?

Explore NERV — open-source Java libraries for audit trails, persistence, exception handling, and reliable event-driven architecture.

Explore NERV on GitHub →