new MigrateService(mid)
Constructor
Parameters:
| Name | Type | Description |
|---|---|---|
mid |
Midgar | Midgar instance |
Members
-
config :Object
-
Plugin config
Type:
- Object
-
plugin :MigratePlugin
-
Migrate plugin instance
Type:
-
storages :Object
-
Storages
Type:
- Object
Methods
-
_getMigration(executedMigration, files, type)
-
Return version file corresponding to excecuted version Oject
Parameters:
Name Type Description executedMigrationObject { {Sting} plugin Plugin name {Sting} name Migration name (relative file path) {Sting} type Migration type (schema|data) } filesArray Array of Object file typeString Migration type (schema|data) Returns:
-
- Type
- Object
-
@private
-
-
_isExecuted(versionName, plugin, type, executedMigrations)
-
Return true if the version file is already executed or false
Parameters:
Name Type Description versionNameString Migration filename pluginString Plugin name typeString Migration type (schema | data) executedMigrationsArray Executed version files Returns:
-
- Type
- Boolean
-
private
-
-
addStorage(key, storage)
-
Add storage
Parameters:
Name Type Description keyString Storage key storageMigrateStorage Storage instance -
<async> down()
-
Downgrade num executed migrations
Returns:
- Type
- Array
-
<async> getPendingMigrations(storageKey)
-
Return pending migrations
Parameters:
Name Type Description storageKeyString Storage key Returns:
- Type
- Array
-
getStorage(key)
-
Return storage instance by key
Parameters:
Name Type Default Description keyString null Storage key Returns:
- Type
- MigrateStroage
-
<async> init()
-
Init service Let other plugin add storage
-
isVesionFile(filename)
-
Check if a filename match with the verions filename reg exp
Parameters:
Name Type Description filenamestring File name Returns:
- Type
- boolean
-
<async> up(num, storageKey)
-
Execute num pending migrations
Parameters:
Name Type Default Description numint null Number of version to execute storageKeyString null Storage key Returns:
- Type
- Array