Skip to content

Migrator

redoMigration()

redoMigration() — returns string

Available in: migrator Category: General Functions

Allows you to rerun a specific database migration version. This can be useful for testing migrations, correcting issues in a migration, or resetting a schema change during development. While it can be called directly from your application code, it is generally recommended to use this function via the CommandBox CLI or the Wheels GUI migration interface, as these provide safer execution and logging.

NameTypeRequiredDefaultDescription
versionstringnoThe Database schema version to rerun
1. Rerun a specific migration version
result = redoMigration(version="202509250915");
writeOutput(result); // Returns status or log of the migration rerun

2. Using redoMigration in a script for testing
if (environment() == "development") {
    redoMigration(version="202509250920");
}

3. Rerun latest migration (if version not specified)
result = redoMigration();
writeOutput(result);