Redgate Flyway

Callbacks

Flyway offers you the possibility to hook into its lifecycle by using Callbacks. In order to use these callbacks, name a script after the callback name (e.g. afterMigrate.sql) and put it in your configured callbacks location.

Whenever the conditions are met, the callback script will be run. For example, an afterMigrate.sql script will execute after running the migrate command.

Callbacks are supported for a variety of different Flyway operations, such as migrate, undo, and clean. For a complete list of callback events, see Callback Events.

Note: Callbacks are partially supported by Native Connectors.

Common usages of callbacks

Callbacks are commonly used for

  • Recompiling procedures
  • Updating materialized views
  • Storage housekeeping (VACUUM for PostgreSQL for example)

Configuring callbacks for deployment

See Executing scripts before or after deployment via callbacks


Didn't find what you were looking for?