Skip to content

Migrator

getCurrentMigrationVersion()

getCurrentMigrationVersion() — returns string

Available in: migrator Category: General Functions

Returns current database version. Whilst you can use this in your application, the recommended usage is via either the CLI or the provided GUI interface

// 1. Get current database version
currentVersion = application.wheels.migrator.getCurrentMigrationVersion();
// currentVersion -> "20240315120000"  (timestamp-style version string, or "0" if no migrations have run)

// 2. Display version status in a maintenance view
currentVersion = application.wheels.migrator.getCurrentMigrationVersion();
if (currentVersion == "0") {
    writeOutput("No migrations have been applied yet.");
} else {
    writeOutput("Database is at version: " & currentVersion);
}