Documentation

PhinxAdapter
in package

Table of Contents

Methods

ensureUpToDate()  : array<string|int, mixed>|void
Checks the number of existing migration files compared to executed migrations in the database.
migrate()  : string
Runs any pending migrations. Used for installation and upgrades. Resource heavy, only call when needed.
rollback()  : string
Rolls back migrations Logs output of Phinx to other-log.log file.

Methods

ensureUpToDate()

Checks the number of existing migration files compared to executed migrations in the database.

public static ensureUpToDate(string $module[, string|null $migrationDir = null ][, bool $returnResults = false ]) : array<string|int, mixed>|void

Alternatively we could check the output of a Phinx command, but that takes ~8x as long to execute.

TODO: return type as array|never (8.1)

Parameters
$module : string

Module name

$migrationDir : string|null = null

Migration directory

$returnResults : bool = false

If true the results will be returned - otherwise script execution is ended

Return values
array<string|int, mixed>|void

migrate()

Runs any pending migrations. Used for installation and upgrades. Resource heavy, only call when needed.

public static migrate(string $module[, string|null $migrationDir = null ]) : string

Logs output of Phinx to other-log.log file.

Parameters
$module : string

Module name

$migrationDir : string|null = null

Migration directory to use

Return values
string

Output of the migration command from Phinx as if it was executed in the console.

rollback()

Rolls back migrations Logs output of Phinx to other-log.log file.

public static rollback(string $module, string $migrationDir[, int $since = 0 ]) : string
Parameters
$module : string

Module name

$migrationDir : string

Migration directory to use

$since : int = 0

Version of earliest migration to rollback, default 0 for all

Tags
throws
Exception

If unable to rollback

Return values
string

Output of the migration command from Phinx as if it was executed in the console.


        
On this page

Search results