Migrator
redoMigration()
Signature
Section titled “Signature”redoMigration() — returns string
Available in: migrator
Category: General Functions
Description
Section titled “Description”Reruns the specified migration version. Whilst you can use this in your application, the recommended usage is via either the CLI or the provided GUI interface
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
version | string | no | — | The Database schema version to rerun |
Examples
Section titled “Examples”// 1. Redo the current (most recent) migration — rolls it back then re-applies it
result = application.wheels.migrator.redoMigration();
// result -> "
// ------- 20240315120000_add_status_to_orders ----------------------
// "
// 2. Redo a specific migration version
result = application.wheels.migrator.redoMigration(version="20240101000000");
// result -> "
// ------- 20240101000000_create_users ------------------------------
// "
// 3. Check for errors after redoing a migration
result = application.wheels.migrator.redoMigration(version="20240315120000");
if (FindNoCase("Error", result)) {
writeOutput("Redo failed: " & result);
} else {
writeOutput("Migration redone successfully.");
}