Properties

$options

$options : array

Type

array

$schemaTableName

$schemaTableName : string

Type

string

$connection

$connection : \PDO

Type

\PDO

$commandStartTime

$commandStartTime : float

Type

float

Methods

__construct()

__construct(array  $options, \think\console\Input  $input = null, \think\console\Output  $output = null) 

Class Constructor.

Parameters

array $options

Options

\think\console\Input $input

Input Interface

\think\console\Output $output

Output Interface

setOptions()

setOptions(array  $options) : \Phinx\Db\Adapter\AdapterInterface

Set adapter configuration options.

Parameters

array $options

Returns

\Phinx\Db\Adapter\AdapterInterface

getOptions()

getOptions() : array

Get all adapter options.

Returns

array

hasOption()

hasOption(string  $name) : boolean

Check if an option has been set.

Parameters

string $name

Returns

boolean

getOption()

getOption(string  $name) : mixed

Get a single adapter option, or null if the option does not exist.

Parameters

string $name

Returns

mixed

setSchemaTableName()

setSchemaTableName(string  $schemaTableName) : \Phinx\Db\Adapter\PdoAdapter

Sets the schema table name.

Parameters

string $schemaTableName

Schema Table Name

Returns

\Phinx\Db\Adapter\PdoAdapter

getSchemaTableName()

getSchemaTableName() : string

Gets the schema table name.

Returns

string

setConnection()

setConnection(\PDO  $connection) : \Phinx\Db\Adapter\AdapterInterface

Sets the database connection.

Parameters

\PDO $connection

Connection

Returns

\Phinx\Db\Adapter\AdapterInterface

getConnection()

getConnection() : \PDO

Gets the database connection

Returns

\PDO

setCommandStartTime()

setCommandStartTime(integer  $time) : \Phinx\Db\Adapter\AdapterInterface

Sets the command start time

Parameters

integer $time

Returns

\Phinx\Db\Adapter\AdapterInterface

getCommandStartTime()

getCommandStartTime() : integer

Gets the command start time

Returns

integer

startCommandTimer()

startCommandTimer() : void

Start timing a command.

endCommandTimer()

endCommandTimer() : void

Stop timing the current command and write the elapsed time to the output.

writeCommand()

writeCommand(string  $command, array  $args = array()) : void

Write a Phinx command to the output.

Parameters

string $command

Command Name

array $args

Command Args

connect()

connect() : void

Initializes the database connection.

disconnect()

disconnect() : void

Closes the database connection.

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(\Phinx\Db\Table  $table, array  $row) : void

Inserts data into a table.

Parameters

\Phinx\Db\Table $table

where to insert data

array $row

getVersions()

getVersions() : array

Get all migrated version numbers.

Returns

array

getVersionLog()

getVersionLog() : array

Get all migration log entries, indexed by version number.

Returns

array

migrated()

migrated(\Phinx\Migration\MigrationInterface  $migration, string  $direction, integer  $startTime, integer  $endTime) : \Phinx\Db\Adapter\AdapterInterface

Records a migration being run.

Parameters

\Phinx\Migration\MigrationInterface $migration

Migration

string $direction

Direction

integer $startTime

Start Time

integer $endTime

End Time

Returns

\Phinx\Db\Adapter\AdapterInterface

resetAllBreakpoints()

resetAllBreakpoints() : integer

Reset all migration breakpoints.

Returns

integer —

The number of breakpoints reset

hasSchemaTable()

hasSchemaTable() : boolean

Does the schema table exist?

Returns

boolean

createSchemaTable()

createSchemaTable() : void

Creates the schema table.

getAdapterType()

getAdapterType() : string

Returns the adapter type.

Returns

string

getColumnTypes()

getColumnTypes() : array

Returns an array of the supported Phinx column types.

Returns

array

isValidColumnType()

isValidColumnType(\Phinx\Db\Table\Column  $column) : boolean

Checks that the given column is of a supported type.

Parameters

\Phinx\Db\Table\Column $column

Returns

boolean

castToBool()

castToBool(mixed  $value) : mixed

Cast a value to a boolean appropriate for the adapter.

Parameters

mixed $value

The value to be cast

Returns

mixed