简体   繁体   中英

using liquibase to migrate data

We have two identical database (say A and B), and wonder if its possible to use liquibase to migrate selective data from A to B.

A is a read/write database and B is read-only. We have written a system where users make changes to A and then 'copy' only selective changes made to B.

I was wondering if it was possible/good idea to use liquibase to do this.

The idea is to either;

  1. Insert new records in B if they don't exist and Update records if they do
  2. Delete all the data in all the tables in B and repopulate them with the ones from A

We already use liquibase to manage database changes to our database structure.

Thanks, Jack.

No, it is not what Liquibase is designed for. Liquibase's primary function is to make sure that changeSets defined in the changelog file are ran against a given database. Those changeSets can be data changes or schema changes, but they need to be defined in the changelog file.

Liquibase does have some diff features, but they are secondary functionality and make no attempt at comparing data beyond populating all data from a table.

Since the copy process is selective, it sounds like there needs to be some level of UI and/or business logic around it in your application and including the actual copy logic in your application probably makes the most sense.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM