Aplus Framework Docs

Migrator
in package

Class Migrator.

Table of Contents

$database  : Database
$directories  : array<string|int, mixed>
$table  : string
__construct()  : mixed
addDirectory()  : static
getDatabase()  : Database
getDirectories()  : array<int, string>
getLastMigrationName()  : string|null
Get current migrated version from Database.
getTable()  : string
migrateDown()  : Generator<string|int, string>
migrateTo()  : Generator<string|int, string>
migrateUp()  : Generator<string|int, string>
setDatabase()  : static
setTable()  : static
deleteRow()  : int|string
getFiles()  : array<int, string>
getMigrations()  : Generator<string, Migration>
getMigrationsAsc()  : Generator<string, Migration>
getMigrationsDesc()  : Generator<string, Migration>
insertRow()  : int|string
prepare()  : void

Properties

$directories

protected array<string|int, mixed> $directories = []

Methods

__construct()

public __construct(Database $database, array<string|int, string> $directories[, string $table = 'Migrations' ]) : mixed
Parameters
$database : Database
$directories : array<string|int, string>
$table : string = 'Migrations'
Return values
mixed

addDirectory()

public addDirectory(string $directory) : static
Parameters
$directory : string
Return values
static

getDirectories()

public getDirectories() : array<int, string>
Return values
array<int, string>

getLastMigrationName()

Get current migrated version from Database.

public getLastMigrationName() : string|null
Return values
string|null

getTable()

public getTable() : string
Return values
string

migrateDown()

public migrateDown([int|null $quantity = null ]) : Generator<string|int, string>
Parameters
$quantity : int|null = null
Return values
Generator<string|int, string>

migrateTo()

public migrateTo(string $name) : Generator<string|int, string>
Parameters
$name : string
Return values
Generator<string|int, string>

migrateUp()

public migrateUp([int|null $quantity = null ]) : Generator<string|int, string>
Parameters
$quantity : int|null = null
Return values
Generator<string|int, string>

setTable()

public setTable(string $table) : static
Parameters
$table : string
Return values
static

deleteRow()

protected deleteRow(string $name) : int|string
Parameters
$name : string
Return values
int|string

getFiles()

protected getFiles() : array<int, string>
Return values
array<int, string>

getMigrations()

protected getMigrations(array<string|int, string> $files) : Generator<string, Migration>
Parameters
$files : array<string|int, string>
Return values
Generator<string, Migration>

insertRow()

protected insertRow(string $name) : int|string
Parameters
$name : string
Return values
int|string

prepare()

protected prepare() : void
Return values
void

Search results