Constants

EXIT_STATUS_DOWN

EXIT_STATUS_DOWN = 1 : integer

EXIT_STATUS_MISSING

EXIT_STATUS_MISSING = 2 : integer

Properties

$output

$output : \think\console\Output

Type

\think\console\Output

$migrations

$migrations : array

Type

array

$seeds

$seeds : array

Type

array

$currentVersion

$currentVersion : integer

Type

integer

Methods

__construct()

__construct(\Phinx\Config  $config, \think\console\Output  $output) 

Class Constructor.

Parameters

\Phinx\Config $config

Configuration Object

\think\console\Output $output

Console Output

printStatus()

printStatus(null  $format = null) : integer

Prints the specified environment's migration status.

Parameters

null $format

Returns

integer —

0 if all migrations are up, or an error code

migrateToDateTime()

migrateToDateTime(\DateTime  $dateTime) : void

Migrate to the version of the database on a given date.

Parameters

\DateTime $dateTime

Date to migrate to

rollbackToDateTime()

rollbackToDateTime(\DateTime  $dateTime) : void

Roll back to the version of the database on a given date.

Parameters

\DateTime $dateTime

Date to roll back to

migrate()

migrate(integer  $version = null) : void

Migrate an environment to the specified version.

Parameters

integer $version

executeMigration()

executeMigration(\Phinx\Migration\MigrationInterface  $migration, string  $direction = \Phinx\Migration\MigrationInterface::UP) : void

Execute a migration against the specified environment.

Parameters

\Phinx\Migration\MigrationInterface $migration

Migration

string $direction

Direction

executeSeed()

executeSeed(\Phinx\Seed\SeedInterface  $seed) : void

Execute a seeder against the specified environment.

Parameters

\Phinx\Seed\SeedInterface $seed

Seed

rollback()

rollback(integer  $version = null) : void

Rollback an environment to the specified version.

Parameters

integer $version

seed()

seed(string  $seed = null) : void

Run database seeders against an environment.

Parameters

string $seed

Seeder

setOutput()

setOutput(\think\console\Output  $output) : \Phinx\Migration\Manager

Sets the console output.

Parameters

\think\console\Output $output

Output

Returns

\Phinx\Migration\Manager

getOutput()

getOutput() : \think\console\Output

Gets the console output.

Returns

\think\console\Output

setMigrations()

setMigrations(array  $migrations) : \Phinx\Migration\Manager

Sets the database migrations.

Parameters

array $migrations

Migrations

Returns

\Phinx\Migration\Manager

getMigrations()

getMigrations() : array<mixed,\Phinx\Migration\AbstractMigration>

Gets an array of the database migrations.

Throws

\InvalidArgumentException

Returns

array<mixed,\Phinx\Migration\AbstractMigration>

setSeeds()

setSeeds(array  $seeds) : \Phinx\Migration\Manager

Sets the database seeders.

Parameters

array $seeds

Seeders

Returns

\Phinx\Migration\Manager

getSeeds()

getSeeds() : array<mixed,\Phinx\Seed\AbstractSeed>

Gets an array of database seeders.

Throws

\InvalidArgumentException

Returns

array<mixed,\Phinx\Seed\AbstractSeed>

getConfig()

getConfig() : \Phinx\Config

Gets the config.

Returns

\Phinx\Config

getVersions()

getVersions() : array

Gets all migrated version numbers.

Returns

array

getVersionLog()

getVersionLog() : array

Get all migration log entries, indexed by version number.

Returns

array

setCurrentVersion()

setCurrentVersion(integer  $version) : \Phinx\Migration\Manager\Environment

Sets the current version of the environment.

Parameters

integer $version

Environment Version

Returns

\Phinx\Migration\Manager\Environment

getCurrentVersion()

getCurrentVersion() : integer

Gets the current version of the environment.

Returns

integer

setAdapter()

setAdapter(\Phinx\Db\Adapter\AdapterInterface  $adapter) : \Phinx\Migration\Manager\Environment

Sets the database adapter.

Parameters

\Phinx\Db\Adapter\AdapterInterface $adapter

Database Adapter

Returns

\Phinx\Migration\Manager\Environment