Flyway
- ✅ Supported. You can point Flyway at any JDBC URL, so you can run the same migration scripts against multiple databases.
- Each database keeps its own
flyway_schema_historytable. - You typically run:
flyway -url=jdbc:postgresql://db1:5432/app -user=user -password=pass migrate
flyway -url=jdbc:postgresql://db2:5432/app -user=user -password=pass migrate
Or configure multiple datasources in CI/CD.
Liquibase
- ✅ Also supported. You just configure different
urlvalues inliquibase.propertiesor pass them via CLI. - Each database will maintain its own
DATABASECHANGELOGandDATABASECHANGELOGLOCKtables. - Example:
liquibase --url="jdbc:mysql://db1:3306/app" update
liquibase --url="jdbc:mysql://db2:3306/app" update
⚠️ Things to watch out for
- Separate history tables per DB → each DB tracks migrations independently.
- Idempotent scripts → make sure migrations can run cleanly in all environments.
- Automation → often wrapped in CI/CD jobs or scripts to apply to multiple databases in sequence.
- Schema differences → if your DBs drift, the same migration may fail on one but succeed on another.