Tutorial - Write your own migration scripts
Published 23 January 2025
You can also add your own migration scripts in the project folder. Make sure you are following your project's naming convention (V###__<description>.sql
, R__<description>.sql, or U###<description>.sql
). This can be useful for migration scripts that deal with updating transactional data or for scripts that are supplied to you by someone else.
After opening a project, use the folder icon
You can also add new migration scripts on the Migrations tab:
→
You can optionally use the flyway add command to generate an empty migration with an incremented version:
- flyway add
For example if two migration locations exist with the following contents:
- $ ls legacy-migrations
- B1.0.0__Baseline.sql
- ...
- V1.0.25__Migration.sql
- $ ls migrations
- V2.0.1__Migration.sql
- ...
- V2.0.54__Migration.sql
Then Flyway would calculate the next migration version to be 2.0.55
.
You can then write the SQL you need in the file.