Class: MigrateService

MigrateService

Midgar migrate service

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
executedMigration Object { {Sting} plugin Plugin name {Sting} name Migration name (relative file path) {Sting} type Migration type (schema|data) }
files Array Array of Object file
type String 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
versionName String Migration filename
plugin String Plugin name
type String Migration type (schema | data)
executedMigrations Array Executed version files
Returns:
  • Type
    Boolean
  • private

addStorage(key, storage)

Add storage
Parameters:
Name Type Description
key String Storage key
storage MigrateStorage Storage instance

<async> down()

Downgrade num executed migrations
Returns:
Type
Array

<async> getPendingMigrations(storageKey)

Return pending migrations
Parameters:
Name Type Description
storageKey String Storage key
Returns:
Type
Array

getStorage(key)

Return storage instance by key
Parameters:
Name Type Default Description
key String 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
filename string File name
Returns:
Type
boolean

<async> up(num, storageKey)

Execute num pending migrations
Parameters:
Name Type Default Description
num int null Number of version to execute
storageKey String null Storage key
Returns:
Type
Array