Callback Events
Published 15 January 2025
Flyway offers you the possibility to hook into its lifecycle by using Callbacks.
For more information see Callbacks.
Note: Callbacks are partially supported by Native Connectors.
List of events
| Migrate | Execution |
|---|---|
| beforeMigrate | Before Migrate runs |
| beforeRepeatables | Before all repeatable migrations during Migrate |
| beforeEachMigrate | Before every single migration during Migrate |
| beforeEachMigrateStatement | Before every single statement of a migration during Migrate |
| afterEachMigrateStatement | After every single successful statement of a migration during Migrate |
| afterEachMigrateStatementError | After every single failed statement of a migration during Migrate |
| afterEachMigrate | After every single successful migration during Migrate |
| afterEachMigrateError | After every single failed migration during Migrate |
| afterMigrate | After Migrate command succeeds |
| afterMigrateApplied | After Migrate command succeeds where at least one migration has been applied |
| afterVersioned | After all versioned migrations during Migrate |
| afterMigrateError | After Migrate command fails |
| Undo | Execution |
|---|---|
| beforeUndo Flyway Teams |
Before Undo runs |
| beforeEachUndo Flyway Teams |
Before every single migration during Undo |
| beforeEachUndoStatement Flyway Teams |
Before every single statement of a migration during Undo |
| afterEachUndoStatement Flyway Teams |
After every single successful statement of a migration during Undo |
| afterEachUndoStatementError Flyway Teams |
After every single failed statement of a migration during Undo |
| afterEachUndo Flyway Teams |
After every single successful migration during Undo |
| afterEachUndoError Flyway Teams |
After every single failed migration during Undo |
| afterUndo Flyway Teams |
After Undo command succeeds |
| afterUndoError Flyway Teams |
After Undo command fails |
| Deploy | Execution |
|---|---|
| beforeDeploy | Before Deploy runs |
| afterDeploy | After Deploy command succeeds |
| afterDeployError | After Deploy command fails |
| Clean | Execution |
|---|---|
| beforeClean | Before Clean runs |
| afterClean | After Clean command succeeds |
| afterCleanError | After Clean command fails |
| Info | Execution |
|---|---|
| beforeInfo | Before Info runs |
| afterInfo | After Info command succeeds |
| afterInfoError | After Info command fails |
Note: It is strongly discouraged to include any write-related callbacks for the Info command. The Info command may be internally triggered by Flyway.
| Validate | Execution |
|---|---|
| beforeValidate | Before Validate runs |
| afterValidate | After Validate command succeeds |
| afterValidateError | After Validate command fails |
| Baseline | Execution |
|---|---|
| beforeBaseline | Before Baseline runs |
| afterBaseline | After Baseline command succeeds |
| afterBaselineError | After Baseline command fails |
| Repair | Execution |
|---|---|
| beforeRepair | Before Repair runs |
| afterRepair | After Repair command succeeds |
| afterRepairError | After Repair command fails |
| Name | Execution |
|---|---|
| createSchema [deprecated, use beforeCreateSchema] | Before automatically creating non-existent schemas |
| beforeCreateSchema | Before automatically creating non-existent schemas |
| beforeConnect Redgate Flyway Community | Before Flyway connects to the database |
| afterConnect | Immediately after Flyway connects to the database |