Constructor
new Migrator(head)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
head |
module:core/migrate~Migration
|
The latest migration class to be loaded. |
Methods
getLatestVersion() → {string}
Get the latest target version among all loaded migrations.
- Source:
Returns:
- Type:
-
string
The latest target version.
isOudated(version) → {boolean}
Check if the given version is the latest target version.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
version |
string
|
A version number to be checked. |
Returns:
- Type:
-
boolean
true if the given version is the latest version.
migrate(config, toVersion, callback) → {Object}
Upgrade a given configuration to a given target version.
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
config |
Object
|
The configuration object to be upgraded. | |
toVersion |
string
|
null | Target version number. |
callback |
function
|
null | An optional callback function called when each migration is done. It takes the original version of the configuration object and the current migration version as parameters. |
Returns:
- Type:
-
Object
The upgrade configuration object.