PHP Class Doctrine\DBAL\Migrations\Migration

Since: 2.0
Author: Jonathan H. Wage ([email protected])
Afficher le fichier Open project: doctrine/migrations Class Usage Examples

Méthodes publiques

Méthode 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

Méthode Description
migrationsCanExecute ( callable $confirm = null )
noMigrations ( )

Method Details

__construct() public méthode

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

getSql() public méthode

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.
Résultat array $sql The array of SQL queries.

migrate() public méthode

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.
Résultat array An array of migration sql statements. This will be empty if the the $confirm callback declines to execute the migration

setNoMigrationException() public méthode

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

writeSqlFile() public méthode

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.
Résultat boolean $written