Search code examples
postgresqldatabase-migrationflyway

Flyway migration test particular migration data transformation


I have migration that transforms complex jsonb object into another jsonb object but with different structure and store it in new column existing_column_name_v2.

How to test that to make sure I did everything ok?

Here are my steps I am thinking right now:

  • Apply migrations up to the last one
  • Feed the data
  • Apply last migration
  • Run tests in language of choice and compare results

I am not sure how to execute just migrations I need with Flyway.


Solution

  • To migrate to a specific version, use flyway migrate target=<version> as described in the Flyway docs.