PHP Class Doctrine\DBAL\Migrations\Migration

Since: 2.0
Author: Jonathan H. Wage ([email protected])
ファイルを表示 Open project: doctrine/migrations Class Usage Examples

Public Methods

Method Description
__construct ( Configuration $configuration ) Construct a Migration instance
getSql ( string $to = null ) : array Get the array of versions and SQL queries that would be executed for each version but do not execute anything.
migrate ( string $to = null, boolean $dryRun = false, boolean $timeAllQueries = false, callable $confirm = null ) : array Run a migration to the current version or the given target version.
setNoMigrationException ( boolean $noMigrationException = false )
writeSqlFile ( string $path, string $to = null ) : boolean Write a migration SQL file to the given path

Private Methods

Method Description
migrationsCanExecute ( callable $confirm = null )
noMigrations ( )

Method Details

__construct() public method

Construct a Migration instance
public __construct ( Configuration $configuration )
$configuration Doctrine\DBAL\Migrations\Configuration\Configuration A migration Configuration instance

getSql() public method

Get the array of versions and SQL queries that would be executed for each version but do not execute anything.
public getSql ( string $to = null ) : array
$to string The version to migrate to.
return array $sql The array of SQL queries.

migrate() public method

Run a migration to the current version or the given target version.
public migrate ( string $to = null, boolean $dryRun = false, boolean $timeAllQueries = false, callable $confirm = null ) : array
$to string The version to migrate to.
$dryRun boolean Whether or not to make this a dry run and not execute anything.
$timeAllQueries boolean Measuring or not the execution time of each SQL query.
$confirm callable A callback to confirm whether the migrations should be executed.
return array An array of migration sql statements. This will be empty if the the $confirm callback declines to execute the migration

setNoMigrationException() public method

public setNoMigrationException ( boolean $noMigrationException = false )
$noMigrationException boolean Throw an exception or not if no migration is found. Mostly for Continuous Integration.

writeSqlFile() public method

Write a migration SQL file to the given path
public writeSqlFile ( string $path, string $to = null ) : boolean
$path string The path to write the migration SQL file.
$to string The version to migrate to.
return boolean $written