Script migrations
Published 19 December 2024
Sometimes it may be more desirable to use a scripting language for migrations. Flyway currently supports the .ps1
, .bat
, .cmd
, .sh
, .bash
, .py
file extensions as migrations, and on non-windows platforms it also supports migrations without extensions (assuming a valid shebang).
Note: Script migrations are not currently supported by Native Connectors.
These migrations follow the same naming scheme as SQL migrations, with only the file extension being different. For example V1__execute_batch_tool.ps1
is a valid migration.
Script migrations can be used for a number of tasks such as:
- Triggering execution of a 3rd party application as part of the migrations (such as a batch upload tool)
- Cleaning up local files (such as those created by SQL*Plus SPOOL)
Important notes
On linux, if executing an extensionless migration that is not set to be executable, Flyway will attempt to set the file to be executable before running it.
The migration checksum is only calculated for the migration itself, not for any files it references or loads.