We need a tool that helps us to migrate. Migrations from database systems or individual tables. We need a version control for our database.
In the context of our project, we chose Flyway. Flyway and Liquibase offer the same functionalities. Whereby Liquibase is a real powerhouse. Flyway is a ligth version and easier to use. Migrations are written with SQL. Liquibase, on the other hand, offers several ways to migrate a database, for example SQL, XML, YAML and more. However, SQL is completely sufficient
To avoid problems with a database versioning with multiple branches, there are two possibilities.
Example for our project: V3.13.145 .2020.07.08.11.10 __fix_column_lengths.sql
You can read here the meaning of the version naming. Only numeric characters are allowed: Only 0..9 and . are allowed.
“This will prevent version number conflicts from happening (I’m assuming including hours and minutes suffices for this) but creates another problem: versions will not be guaranteed to be merged back to master in order.
That means that Flyway could run against a database to apply a migration like above, but then in a later release finds that there’s now a new migration 2017.7.6.12.12 that hasn’t been applied yet but has a version that’s lower than the latest migration that has been applied already.
By default Flyway will consider this an error and your migration will fail. However, you can simply tell Flyway that this is all expected and that it should simply execute all migrations that haven’t been applied yet by setting its outOfOrder property to true.”
Source: Come Fly With Me: Flyway usage patterns part I
Each team has a fixed version number.
Impact: 1
Analysis: 2
Requirements: 3
Variants: 4
Example for our project: V3.13.145 .[Team number] __fix_column_lengths.sql
Here in the wiki is a guide on how to proceed in the flyway: Database version controlling with Flyway.
We chose Flyway as version control tool for our database.