Constants

CHANGE

CHANGE = 'change' : string

UP

UP = 'up' : string

DOWN

DOWN = 'down' : string

Methods

up()

up() : void

Migrate Up

down()

down() : void

Migrate Down

getInput()

getInput() : \think\console\Input

Gets the input object to be used in migration object

Returns

\think\console\Input

getOutput()

getOutput() : \think\console\Output

Gets the output object to be used in migration object

Returns

\think\console\Output

getName()

getName() : string

Gets the name.

Returns

string

setVersion()

setVersion(float  $version) : \Phinx\Migration\MigrationInterface

Sets the migration version number.

Parameters

float $version

Version

Returns

\Phinx\Migration\MigrationInterface

getVersion()

getVersion() : float

Gets the migration version number.

Returns

float

execute()

execute(string  $sql) : integer

Executes a SQL statement and returns the number of affected rows.

Parameters

string $sql

SQL

Returns

integer

query()

query(string  $sql) : array

Executes a SQL statement and returns the result as an array.

Parameters

string $sql

SQL

Returns

array

fetchRow()

fetchRow(string  $sql) : array

Executes a query and returns only one row as an array.

Parameters

string $sql

SQL

Returns

array

fetchAll()

fetchAll(string  $sql) : array

Executes a query and returns an array of rows.

Parameters

string $sql

SQL

Returns

array

insert()

insert(string  $tableName, array  $data) : void

Insert data into a table.

Parameters

string $tableName
array $data

createDatabase()

createDatabase(string  $name, array  $options) : void

Create a new database.

Parameters

string $name

Database Name

array $options

Options

dropDatabase()

dropDatabase(string  $name) : void

Drop a database.

Parameters

string $name

Database Name

hasTable()

hasTable(string  $tableName) : boolean

Checks to see if a table exists.

Parameters

string $tableName

Table Name

Returns

boolean

table()

table(string  $tableName, array  $options) : \Phinx\Db\Table

Returns an instance of the <code>\Table</code> class.

You can use this class to create and manipulate tables.

Parameters

string $tableName

Table Name

array $options

Options

Returns

\Phinx\Db\Table