Migrator
+ Inheritance diagram for Migrator:

Description

Migrates.

See also
MigrationInterface

Protected Properties

DB $db
 
string $dir
 
Table $table
 

Public Static Methods

magic static self factory (DB $db, string $dir)
 ; More...
 

Public Methods

 __construct (DB $db, string $dir)
 
null string down (string $to=null)
 Migrates down within a transaction. More...
 
null string getCurrent ()
 Returns the sequence identifier of the most recent upgrade. More...
 
string getDir ()
 
Table getTable ()
 Returns the __migrations__ table, creating it if needed. More...
 
null string up (string $to=null)
 Migrates up within a transaction. More...
 

Protected Methods

MigrationInterface getMigration (string $file)
 
string[] glob ()
 Scans the migration directory for <SEQUENCE>.php files. More...
 

Constructor

◆ __construct()

__construct ( DB  $db,
string  $dir 
)
Parameters
DB$db
string$dir

Methods

◆ down()

null string down ( string  $to = null)

Migrates down within a transaction.

Parameters
string$toMigration sequence identifier, or null to step down once.
Returns
null|string The resulting current sequence identifier.

◆ factory()

magic static self factory ( DB  $db,
string  $dir 
)
static

;

Returns
self

◆ getCurrent()

null string getCurrent ( )

Returns the sequence identifier of the most recent upgrade.

Returns
null|string

◆ getDir()

string getDir ( )
final
Returns
string

◆ getMigration()

MigrationInterface getMigration ( string  $file)
protected
Parameters
array$spec
Returns
MigrationInterface

◆ getTable()

Table getTable ( )

Returns the __migrations__ table, creating it if needed.

Returns
Table

◆ glob()

string [] glob ( )
protected

Scans the migration directory for <SEQUENCE>.php files.

Returns
string[] [ sequence => file ]

◆ up()

null string up ( string  $to = null)

Migrates up within a transaction.

Parameters
null | string$toMigration sequence identifier, or null for all upgrades.
Returns
null|string The resulting current sequence identifier.