Judrius
Judrius

Reputation: 227

Copy data from one db to another using liquibase

is it possible to migrate data from one database table into another database table using liquibase?

Now we are running liquibase changesets on two different databases as we have two executions in pom maven file. But is it possible to write one changeset which selects data from one database table and copies to another database table?

Upvotes: 0

Views: 2208

Answers (1)

Fred
Fred

Reputation: 152

You could use your preferred scripting language to query the data from the table and generate insert statements with the result. Once you have the insert statements, put them in a liquibase formatted sql file. and run them on your target database.

The goal is to have already created the files when the data was originally inserted. If your database already existed before you started using liquibase, then it may be a good idea to restore from a backup taken from the day you started using liquibase and sync it from there.

Upvotes: 1

Related Questions