Compare two databases
Published 18 July 2024
You can compare the schema in two different databases using the Flyway CLI.
This is available for SQL Server, Oracle, PostgreSQL, and MySQL databases.
Step-by-step guide
- Take a Snapshot of your source database.
flyway snapshot -url=<jdbc:example:database_source> -user=<username> -password=<password> -snapshot.filename=<C:\snapshots\snapshot_source>
- Take a Snapshot of your target database.
flyway snapshot -url=<jdbc:example:database_target> -user=<username> -password=<password> -snapshot.filename=<C:\snapshots\snapshot_target>
- Use the Check Changes report to compare the two snapshots and identify any differences between the two database schema snapshots.
flyway check -changes -check.nextSnapshot="snapshot_source" -check.deployedSnapshot="snapshot_target"