Tutorial - Handle transactional data changes as part of a versioned migration script
Published 24 January 2025
When you Generate migrations using Flyway Desktop, you select which changes in your schema model folder that you want to create migration scripts for, i.e., which changes are ready to be committed to version control as migration scripts. After selecting these changes, there is a review step. The changes are shown in a versioned migration script at the top of this page and are in the correct order from a dependency perspective. In addition to specifying the exact version and filename you want, you can also edit this script to include any data changes as well. Since this script was generated from changes already on your development database, it will not be re-run against the development database. Most users will write and execute the data change script against the development database in the IDE of their choice and then just copy and paste it into the script at this point. This script can then be committed/pushed to version control and the whole script will be run in CI/CD environments (learn more about Deploying database changes using Flyway).
If you are using Undo scripts, make sure you update any data changes in the corresponding Undo script as well.