MigrationStep
fun MigrationStep(description: String, collect: suspend ExecutionContext.() -> MigrationStepResult): MigrationStep
Factory function to create a MigrationStep instance with a description and action.
This is a convenience function that creates an anonymous implementation of the MigrationStep interface. It's typically used when defining migration steps inline within a Migration configuration block.
Usage Examples:
Direct Step Creation:
val step = MigrationStep("Initialize components") {
initializeComponents()
MigrationStepResult.CONTINUE
}Content copied to clipboard
Within Migration Configuration:
val migration = Migration {
step("Clear old data") {
clearOldData()
MigrationStepResult.CONTINUE
}
// You can also create steps separately and add them
step(MigrationStep("Custom step") {
performCustomMigration()
MigrationStepResult.CONTINUE
})
}Content copied to clipboard
Return
A MigrationStep instance that can be executed by the Migration framework
Parameters
description
A human-readable description of what this step does
collect
The suspend function that implements the migration logic