Migrator
extends AbstractMigrator
in package
Sql migrator class
Tags
Table of Contents
- $current : string
- Current migration position
- $db : AbstractAdapter
- Database adapter
- $migrations : array<string|int, mixed>
- Migrations
- $path : string
- Migration path
- __construct() : mixed
- Constructor
- create() : string
- Create new migration file
- db() : AbstractAdapter
- Get the DB adapter (alias method)
- getCurrent() : string
- Get the migration path
- getDb() : AbstractAdapter
- Get the DB adapter
- getPath() : string
- Get the migration path
- rollback() : Migrator
- Roll back the migrator (down/backward direction)
- rollbackAll() : Migrator
- Roll back all the migrator (down/backward direction)
- run() : Migrator
- Run the migrator (up/forward direction)
- runAll() : Migrator
- Run all the migrator (up/forward direction)
- setPath() : Migrator
- Set the migration path and get migration files
Properties
$current
Current migration position
protected
string
$current
= null
$db
Database adapter
protected
AbstractAdapter
$db
= null
$migrations
Migrations
protected
array<string|int, mixed>
$migrations
= []
$path
Migration path
protected
string
$path
= null
Methods
__construct()
Constructor
public
__construct(AbstractAdapter $db, string $path) : mixed
Instantiate the migrator object
Parameters
- $db : AbstractAdapter
- $path : string
Return values
mixed —create()
Create new migration file
public
static create(string $class[, string $path = null ]) : string
Parameters
- $class : string
- $path : string = null
Tags
Return values
string —db()
Get the DB adapter (alias method)
public
db() : AbstractAdapter
Return values
AbstractAdapter —getCurrent()
Get the migration path
public
getCurrent() : string
Return values
string —getDb()
Get the DB adapter
public
getDb() : AbstractAdapter
Return values
AbstractAdapter —getPath()
Get the migration path
public
getPath() : string
Return values
string —rollback()
Roll back the migrator (down/backward direction)
public
rollback([mixed $steps = 1 ]) : Migrator
Parameters
- $steps : mixed = 1
Return values
Migrator —rollbackAll()
Roll back all the migrator (down/backward direction)
public
rollbackAll() : Migrator
Return values
Migrator —run()
Run the migrator (up/forward direction)
public
run([mixed $steps = 1 ]) : Migrator
Parameters
- $steps : mixed = 1
Return values
Migrator —runAll()
Run all the migrator (up/forward direction)
public
runAll() : Migrator
Return values
Migrator —setPath()
Set the migration path and get migration files
public
setPath(string $path) : Migrator
Parameters
- $path : string