MigrationsEventArgs
and MigrationsVersionEventArgs
expose different API,
please refer to the Code BC breaks section.-v
, -vv
and -vvv
).--show-versions
option from migrations:status
command has been removed,
use migrations:list
instead.--write-sql
option for migrations:migrate
and migrations:execute
does not imply dry-run anymore,--dry-run
parameter instead.--db
option has been renamed to --conn
.execution_time
.migrations:migrate
or migrations:execute
command will automatically upgrade the migration
table structure; a dedicated migrations:sync-metadata-storage
command is available to sync manually the migrations table.<version>
placeholder has been replaced by the <className>
placeholder.migrations.php Before
<?php
return [
'name' => 'My Project Migrations',
'migrations_namespace' => 'MyProject\Migrations',
'table_name' => 'doctrine_migration_versions',
'column_name' => 'version',
'column_length' => 14,
'executed_at_column_name' => 'executed_at',
'migrations_directory' => '/data/doctrine/migrations-docs-example/lib/MyProject/Migrations',
'all_or_nothing' => true,
'check_database_platform' => true,
];
migrations.php After
<?php
return [
'table_storage' => [
'table_name' => 'doctrine_migration_versions',
'version_column_name' => 'version',
'version_column_length' => 191,
'executed_at_column_name' => 'executed_at',
'execution_time_column_name' => 'execution_time',
],
'migrations_paths' => [
'MyProject\Migrations' => '/data/doctrine/migrations/lib/MyProject/Migrations',
'MyProject\Component\Migrations' => './Component/MyProject/Migrations',
],
'all_or_nothing' => true,
'check_database_platform' => true,
];
Files in XML, YAML or JSON also changed in a similar way. Please refer to the official documentation for more details.
Note: the name
property has been removed.
Note: the option in table_storage
needs to be updated only if you have changed the metadata table settings
by using v2 options such as table_name
, column_name
, column_length
or executed_at_column_name
. If you did not change
those settings, it is recommended to not provide the options and let doctrine figure out the best settings.
Most of the code is protected by the @internal
declaration and in a very rare cases you might have dealt with the
internals of this library.
The most important BC breaks are in the Doctrine\Migrations\Configuration\Configuration
class and in the helper
system that now has been replaced by the Doctrine\Migrations\DependencyFactory
functionalities.
Here is a list of the most important changes:
Doctrine\Migrations\Configuration\Configuration
Doctrine\Migrations\Configuration\Configuration
became finalDoctrine\Migrations\Configuration\Configuration::VERSION_FORMAT
was removed, there is not more limitation on the version formatDoctrine\Migrations\Configuration\Configuration#__construct()
was removedDoctrine\Migrations\Configuration\Configuration#setName()
was removedDoctrine\Migrations\Configuration\Configuration#getName()
was removedDoctrine\Migrations\Configuration\Configuration#getConnection()
was removed,
use Doctrine\Migrations\DependencyFactory#getConnection()
Doctrine\Migrations\Configuration\Configuration#setMigrationsTableName()
was removed,
use Doctrine\Migrations\Configuration\Configuration#setMetadataStorageConfiguration
with an instance of Doctrine\Migrations\Metadata\Storage\MetadataStorageConfiguration
Doctrine\Migrations\Configuration\Configuration#getMigrationsTableName()
was removed,
use Doctrine\Migrations\Metadata\Storage\MetadataStorageConfiguration#getMetadataStorageConfiguration
Doctrine\Migrations\Configuration\Configuration#setMigrationsColumnName()
was removed,
use Doctrine\Migrations\Configuration\Configuration#setMetadataStorageConfiguration
with an instance of Doctrine\Migrations\Metadata\Storage\MetadataStorageConfiguration
Doctrine\Migrations\Configuration\Configuration#getMigrationsColumnName()
was removed,
use Doctrine\Migrations\Metadata\Storage\MetadataStorageConfiguration#getMetadataStorageConfiguration
Doctrine\Migrations\Configuration\Configuration#getQuotedMigrationsColumnName()
was removedDoctrine\Migrations\Configuration\Configuration#setMigrationsColumnLength()
was removed,
use Doctrine\Migrations\Configuration\Configuration#setMetadataStorageConfiguration
with an instance of Doctrine\Migrations\Metadata\Storage\MetadataStorageConfiguration
Doctrine\Migrations\Configuration\Configuration#getMigrationsColumnLength()
was removed,
use Doctrine\Migrations\Metadata\Storage\MetadataStorageConfiguration#getMetadataStorageConfiguration
Doctrine\Migrations\Configuration\Configuration#setMigrationsExecutedAtColumnName()
was removed,
use Doctrine\Migrations\Configuration\Configuration#setMetadataStorageConfiguration
with an instance of Doctrine\Migrations\Metadata\Storage\MetadataStorageConfiguration
Doctrine\Migrations\Configuration\Configuration#getMigrationsExecutedAtColumnName()
was removed,
use Doctrine\Migrations\Metadata\Storage\MetadataStorageConfiguration#getMetadataStorageConfiguration
Doctrine\Migrations\Configuration\Configuration#getQuotedMigrationsExecutedAtColumnName()
was removedDoctrine\Migrations\Configuration\Configuration#setMigrationsDirectory()
was removed,
use Doctrine\Migrations\Configuration\Configuration#addMigrationsDirectory()
Doctrine\Migrations\Configuration\Configuration#getMigrationsDirectory()
was removed,
use Doctrine\Migrations\Configuration\Configuration#getMigrationDirectories()
Doctrine\Migrations\Configuration\Configuration#setMigrationsNamespace()
was removed,
use Doctrine\Migrations\Configuration\Configuration#addMigrationsDirectory()
Doctrine\Migrations\Configuration\Configuration#getMigrationsNamespace()
was removed,
use Doctrine\Migrations\Configuration\Configuration#getMigrationDirectories()
Doctrine\Migrations\Configuration\Configuration#setMigrationsFinder()
was removed,
use the dependency factory insteadDoctrine\Migrations\Configuration\Configuration#getMigrationsFinder()
was removed,
use the dependency factory insteadDoctrine\Migrations\Configuration\Configuration#hasVersionMigrated()
was removed,
use the dependency factory insteadDoctrine\Migrations\Configuration\Configuration#getVersionData()
was removedDoctrine\Migrations\Configuration\Configuration#resolveVersionAlias()
was removed,
use Doctrine\Migrations\Version\AliasResolver#resolveVersionAlias()
Doctrine\Migrations\Configuration\Configuration#isMigrationTableCreated()
was removedDoctrine\Migrations\Configuration\Configuration#createMigrationTable()
was removed,
use Doctrine\Migrations\Metadata\Storage\MetadataStorage#ensureInitialized()
Doctrine\Migrations\Configuration\Configuration#getDateTime()
was removedDoctrine\Migrations\Configuration\Configuration#generateVersionNumber()
was removed,
use Doctrine\Migrations\Generator\ClassNameGenerator#generateClassName()
Doctrine\Migrations\Configuration\Configuration#connect()
was removedDoctrine\Migrations\Configuration\Configuration#dispatchMigrationEvent()
was removedDoctrine\Migrations\Configuration\Configuration#dispatchVersionEvent()
was removedDoctrine\Migrations\Configuration\Configuration#dispatchEvent()
was removedDoctrine\Migrations\Configuration\Configuration#getNumberOfExecutedMigrations()
was removed,
use Doctrine\Migrations\DependencyFactory#getMetadataStorage()->getExecutedMigrations()
Doctrine\Migrations\Configuration\Configuration#getNumberOfAvailableMigrations()
was removed,
use Doctrine\Migrations\DependencyFactory#getMigrationRepository()->getMigrations()
Doctrine\Migrations\Configuration\Configuration#getLatestVersion()
was removed,
use Doctrine\Migrations\Version\AliasResolver#resolveVersionAlias()
Doctrine\Migrations\Configuration\Configuration#getMigratedVersions()
was removed,
use Doctrine\Migrations\DependencyFactory#getMetadataStorage()->getExecutedMigrations()
Doctrine\Migrations\Configuration\Configuration#getAvailableVersions()
was removed
use Doctrine\Migrations\DependencyFactory#getMigrationRepository()->getMigrations()
Doctrine\Migrations\Configuration\Configuration#getCurrentVersion()
was removed,
use Doctrine\Migrations\Version\AliasResolver#resolveVersionAlias()
Doctrine\Migrations\Configuration\Configuration#registerMigrationsFromDirectory()
was removed,
use Doctrine\Migrations\Configuration\Configuration#addMigrationsDirectory()
Doctrine\Migrations\Configuration\Configuration#registerMigration()
was removed,
use Doctrine\Migrations\Configuration\Configuration#addMigrationClass()
Doctrine\Migrations\Configuration\Configuration#registerMigrations()
was removed
use Doctrine\Migrations\Configuration\Configuration#addMigrationClass()
Doctrine\Migrations\Configuration\Configuration#getMigrations()
was removed,
use Doctrine\Migrations\DependencyFactory#getMigrationRepository()->getMigrations()
Doctrine\Migrations\Configuration\Configuration#getVersion()
was removedDoctrine\Migrations\Configuration\Configuration#getMigrationsToExecute()
was removed,
use Doctrine\Migrations\Version\MigrationPlanCalculator#getPlanUntilVersion()
to create a migration planDoctrine\Migrations\Configuration\Configuration#getPrevVersion()
was removed,
use Doctrine\Migrations\Version\AliasResolver#resolveVersionAlias()
Doctrine\Migrations\Configuration\Configuration#getNextVersion()
was removed,
use Doctrine\Migrations\Version\AliasResolver#resolveVersionAlias()
Doctrine\Migrations\Configuration\Configuration#getRelativeVersion()
was removedDoctrine\Migrations\Configuration\Configuration#getDeltaVersion()
was removedDoctrine\Migrations\Configuration\Configuration#setOutputWriter()
was removed,
set the Psr\Log\LoggerInterface
service in Doctrine\Migrations\DependencyFactory
Doctrine\Migrations\Configuration\Configuration#getOutputWriter()
was removed,
get the Psr\Log\LoggerInterface
service from Doctrine\Migrations\DependencyFactory
Doctrine\Migrations\Configuration\Configuration#getQueryWriter()
was removedDoctrine\Migrations\Configuration\Configuration#getDependencyFactory()
was removedDoctrine\Migrations\Configuration\Configuration#validate()
was removedDoctrine\Migrations\Configuration\Connection\Loader\Exception
Doctrine\Migrations\Configuration\Connection\Loader\Exception\LoaderException
has been deletedDoctrine\Migrations\Configuration\Connection\Loader\Exception\InvalidConfiguration
has been deletedDoctrine\Migrations\Configuration\Exception
Doctrine\Migrations\Configuration\Exception\ParameterIncompatibleWithFinder
has been deletedDoctrine\Migrations\Configuration\Exception\InvalidConfigurationKey
has been deletedDoctrine\Migrations\Configuration\Exception\MigrationsNamespaceRequired
has been deletedDoctrine\Migrations\Configuration\Exception\XmlNotValid
has been deletedDoctrine\Migrations\Configuration\Exception\YamlNotAvailable
has been deletedDoctrine\Migrations\Configuration\Exception\FileAlreadyLoaded
has been deletedDoctrine\Migrations\Configuration\Exception\JsonNotValid
has been deletedDoctrine\Migrations\Configuration\Exception\YamlNotValid
has been deletedDoctrine\Migrations\Configuration\Exception\FileNotFound::new()
increased from 0 to 1Doctrine\Migrations\Event\MigrationsEventArgs
Doctrine\Migrations\Event\MigrationsEventArgs
became finalDoctrine\Migrations\Event\MigrationsEventArgs#getConfiguration()
was removedDoctrine\Migrations\Event\MigrationsEventArgs#getDirection()
was removed,
use Doctrine\Migrations\Event\MigrationsEventArgs#getPlan()
Doctrine\Migrations\Event\MigrationsEventArgs#isDryRun()
was removed,
use Doctrine\Migrations\Event\MigrationsEventArgs#getMigratorConfiguration()
Doctrine\Migrations\Event\MigrationsEventArgs#__construct()
arguments have been updatedDoctrine\Migrations\Event\MigrationsVersionEventArgs
Doctrine\Migrations\Event\MigrationsVersionEventArgs
became finalDoctrine\Migrations\Event\MigrationsVersionEventArgs#getVersion()
was removed
use Doctrine\Migrations\Event\MigrationsEventArgs#getPlan()
Doctrine\Migrations\Finder
Doctrine\Migrations\Finder\RecursiveRegexFinder
have been removed: ["Doctrine\Migrations\Finder\MigrationDeepFinder"]Doctrine\Migrations\Finder\MigrationDeepFinder
has been deletedDoctrine\Migrations\Tools\Console\Command
Doctrine\Migrations\Tools\Console\Command\*
became finalDoctrine\Migrations\Tools\Console\Command\AbstractCommand
has been renamed into Doctrine\Migrations\Tools\Console\Command\DoctrineCommand
and has been marked as internalDoctrine\Migrations\Tools\Console\Command\*Command#__construct()
changed signature into (?Doctrine\Migrations\DependencyFactory $di, ?string $name)
initialize()
of Class Doctrine\Migrations\Tools\Console\Command\AbstractCommand
visibility reduced from public
to protected
execute()
of Class Doctrine\Migrations\Tools\Console\Command\*Command
visibility reduced from public
to protected
Doctrine\Migrations\Tools\Console\Command\DiffCommand#createMigrationDiffGenerator()
was removedDoctrine\Migrations\Tools\Console\Exception
Doctrine\Migrations\Tools\Console\Exception\SchemaDumpRequiresNoMigrations::new()
increased from 0 to 1Doctrine\Migrations\Tools\Console\Exception\ConnectionNotSpecified
has been deletedMigrations\Tools\Console\Helper
Doctrine\Migrations\DependencyFactory
insteadDoctrine\Migrations\AbstractMigration
Doctrine\Migrations\AbstractMigration#__construct()
changed signature into (Doctrine\DBAL\Connection $conn, PSR\Log\LoggerInterface $logger)
Doctrine\Migrations\AbstractMigration#down()
is not abstract anymore, the default implementation will abort the migration processDoctrine\Migrations\AbstractMigration#$version
was removedDoctrine\Migrations\Provider
Doctrine\Migrations\Provider\SchemaProviderInterface
has been deletedDoctrine\Migrations\Provider\StubSchemaProvider
have been removed: ["Doctrine\Migrations\Provider\SchemaProviderInterface"]Doctrine\Migrations\Exception
Doctrine\Migrations\Exception\MigrationNotConvertibleToSql
has been deletedDoctrine\Migrations\Exception\MigrationsDirectoryRequired
has been deletedDoctrine\Migrations\Version\Factory
became the interface Doctrine\Migrations\Version\MigrationFactory
Doctrine\Migrations\OutputWriter
has been deleted,
use Psr\Log\Loggerinterface
Doctrine\DBAL\Migrations
to Doctrine\Migrations
Your migration classes that previously used to extend Doctrine\DBAL\Migrations\AbstractMigration
now need to extend
Doctrine\Migrations\AbstractMigration
instead. The Doctrine\DBAL\Migrations\AbstractMigration
class will be
deprecated in the 1.8.0
release to prepare for the BC break.
Doctrine\DBAL\Migrations\MigrationsVersion
The Doctrine\DBAL\Migrations\MigrationsVersion
class is no longer available: please refrain from checking the Migrations version at runtime.
Doctrine\Migrations\Migration
to Doctrine\Migrations\Migrator
To make the name more clear and to differentiate from the AbstractMigration
class, Migration
was renamed to Migrator
.
Doctrine\Migrations\%name%Exception
to Doctrine\Migrations\Exception\%name%
doctrine/migrations#636 Follows concept introduced in ORM (doctrine/orm#6743 + doctrine/orm#7210) and naming follows pattern accepted in Doctrine CS.
The method getName()
was defined and it's implementation would change the order in which the migration would be processed.
It would cause discrepancies between the file order in a file browser and the order of execution of the migrations.
The getName()
method as been removed | set final and new getDescription()
method has been added.
The goal of this method is to be able to provide context for the migration.
This context is shown for the last migrated migration when the status command is called.
The --write-sql
option would only output sql contained in the migration and would not update the table containing the migrated migrations.
That option now also output the sql queries necessary to update the table containing the state of the migrations. If you want to go back to the previous behavior just make a request on the bug tracker as for now the need for it is not very clear.
MigrationsVersion::VERSION
used to be a property.
The returned value was fanciful.
It is now a a function so that a different value can be automatically send back if it's a modified version that's used. The returned value is now the git tag. The tag is in lowercase as the other doctrine projects.