Search code examples
sqldatabasescriptingflyway

How can i specify that a particular flyway migration script be run on a different database


I have some migration scripts in my db.migration folder that run on my default database server. I want to add a new migration script but i want it to be run on an entirely different server, without affecting the previous migration scripts.


Solution

  • You essentially need two separate configurations:

    • put migration scripts for server A in a folder and specify that folder as a location in A.conf, which also has the JDBC connection url for server A
    • do the same for server B in a separate folder and specify it in B.conf
    • then flyway migrate -configFiles=A.conf.

    This is fine even if you want the migration version numbers to run in one contiguous sequence.