PHP Класс Doctrine\DBAL\Migrations\Version

С версии: 2.0
Автор: Jonathan H. Wage ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( Configuration $configuration, $version, $class, Doctrine\DBAL\Migrations\Provider\SchemaDiffProviderInterface $schemaProvider = null )
__toString ( )
addSql ( array | string $sql, array $params = [], array $types = [] ) Add some SQL queries to this versions migration
execute ( string $direction, boolean $dryRun = false, boolean $timeAllQueries = false ) : array Execute this migration version up or down and and return the SQL.
getConfiguration ( ) : Configuration Returns the Migrations Configuration object instance
getExecutionState ( )
getMigration ( ) : Doctrine\DBAL\Migrations\AbstractMigration
getTime ( ) : integer Returns the time this migration version took to execute
getVersion ( ) : string Returns the string version in the format YYYYMMDDHHMMSS
isMigrated ( ) : boolean Check if this version has been migrated or not.
markMigrated ( )
markNotMigrated ( )
writeSqlFile ( string $path, string $direction = self::DIRECTION_UP ) : boolean Write a migration SQL file to the given path

Приватные методы

Метод Описание
addQueryParams ( mixed[] $params, string[] $types )
executeRegisteredSql ( $dryRun = false, $timeAllQueries = false )
formatParamsForOutput ( array $params, array $types ) : string | null Formats a set of sql parameters for output with dry run.
markVersion ( $direction )
outputQueryTime ( $queryStart, $timeAllQueries = false )
outputSqlQuery ( integer $idx, string $query ) : void Outputs a SQL query via the OutputWriter.

Описание методов

__construct() публичный метод

public __construct ( Configuration $configuration, $version, $class, Doctrine\DBAL\Migrations\Provider\SchemaDiffProviderInterface $schemaProvider = null )
$configuration Doctrine\DBAL\Migrations\Configuration\Configuration
$schemaProvider Doctrine\DBAL\Migrations\Provider\SchemaDiffProviderInterface

__toString() публичный метод

public __toString ( )

addSql() публичный метод

Add some SQL queries to this versions migration
public addSql ( array | string $sql, array $params = [], array $types = [] )
$sql array | string
$params array
$types array

execute() публичный метод

We are only allowing the addSql call and the schema modification to take effect in the up and down call. This is necessary to ensure that the migration is revertable. The schema is passed to the pre and post method only to be able to test the presence of some table, And the connection that can get used trough it allow for the test of the presence of records.
public execute ( string $direction, boolean $dryRun = false, boolean $timeAllQueries = false ) : array
$direction string The direction to execute the migration.
$dryRun boolean Whether to not actually execute the migration SQL and just do a dry run.
$timeAllQueries boolean Measuring or not the execution time of each SQL query.
Результат array $sql

getConfiguration() публичный метод

Returns the Migrations Configuration object instance
public getConfiguration ( ) : Configuration
Результат Doctrine\DBAL\Migrations\Configuration\Configuration $configuration

getExecutionState() публичный метод

public getExecutionState ( )

getMigration() публичный метод

public getMigration ( ) : Doctrine\DBAL\Migrations\AbstractMigration
Результат Doctrine\DBAL\Migrations\AbstractMigration

getTime() публичный метод

Returns the time this migration version took to execute
public getTime ( ) : integer
Результат integer $time The time this migration version took to execute

getVersion() публичный метод

Returns the string version in the format YYYYMMDDHHMMSS
public getVersion ( ) : string
Результат string $version

isMigrated() публичный метод

Check if this version has been migrated or not.
public isMigrated ( ) : boolean
Результат boolean

markMigrated() публичный метод

public markMigrated ( )

markNotMigrated() публичный метод

public markNotMigrated ( )

writeSqlFile() публичный метод

Write a migration SQL file to the given path
public writeSqlFile ( string $path, string $direction = self::DIRECTION_UP ) : boolean
$path string The path to write the migration SQL file.
$direction string The direction to execute.
Результат boolean $written