Class: Migrator

Migrator(options)

class for migrations.

Constructor

new Migrator(options)

Create Migrator object.

Parameters:
Name Type Description
options Object
Source:

Members

db :ChainDB|WalletDB|null

Type:
Source:

(nullable) ldb :bdb.DB

Type:
  • bdb.DB
Source:

Methods

checkMigrateFlag()

Check migration flags.

Source:
Throws:
Error

(async) checkMigrations()

Get migration list

Source:

createContext(state) → {MigrationContext}

Create context

Parameters:
Name Type Description
state MigrationState
Source:
Returns:
Type
MigrationContext

(async) ensure() → {Promise}

Ensure we have migration entry in DB.

Source:
Returns:
Type
Promise

(private) fromOptions(options)

Recheck options

Parameters:
Name Type Description
options Object
Source:

getLastMigrationID() → {Number}

Get max migration ID from the map

Source:
Returns:
Type
Number

(async) getMigrationsToRun() → {Promise.<Set>}

Get list of migrations to run

Source:
Returns:
Type
Promise.<Set>

(async) getState() → {Promise.<MigrationState>}

Get state

Source:
Returns:
Type
Promise.<MigrationState>

(async) initialize() → {Promise.<MigrationResult>}

Init fresh db.

Source:
Returns:
Type
Promise.<MigrationResult>

(async) migrate() → {Promise.<MigrationResult>}

Do the actual migrations

Source:
Returns:
Type
Promise.<MigrationResult>

(async) saveState(state)

Save state

Parameters:
Name Type Description
state MigrationState
Source:

(async) verifyDB() → {Promise}

Do any necessary database checks

Source:
Returns:
Type
Promise

writeState(b, state)

Write state

Parameters:
Name Type Description
b Batch
state MigrationState
Source: