From f1a0e1f1641a5e3a41c5bed0cb2bbdb4695d184d Mon Sep 17 00:00:00 2001 From: "Jonathan H. Wage" Date: Fri, 18 May 2018 18:33:30 +0100 Subject: [PATCH 1/3] Introduce Doctrine\DBAL\Migrations\AbstractMigration deprecation. --- composer.json | 5 +++-- lib/Doctrine/DBAL/Migrations/AbstractMigration.php | 6 ++++++ .../Tools/Console/Command/GenerateCommand.php | 2 +- lib/Doctrine/Migrations/AbstractMigration.php | 10 ++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 lib/Doctrine/Migrations/AbstractMigration.php diff --git a/composer.json b/composer.json index 149c5b5905..3217b5ca3c 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,8 @@ }, "autoload": { "psr-4": { - "Doctrine\\DBAL\\Migrations\\": "lib/Doctrine/DBAL/Migrations" + "Doctrine\\DBAL\\Migrations\\": "lib/Doctrine/DBAL/Migrations", + "Doctrine\\Migrations\\": "lib/Doctrine/Migrations" } }, "autoload-dev": { @@ -41,7 +42,7 @@ }, "extra": { "branch-alias": { - "dev-master": "v1.7.x-dev" + "dev-master": "v1.8.x-dev" } }, "bin": [ diff --git a/lib/Doctrine/DBAL/Migrations/AbstractMigration.php b/lib/Doctrine/DBAL/Migrations/AbstractMigration.php index d689bcd8a0..cc7e4c950c 100644 --- a/lib/Doctrine/DBAL/Migrations/AbstractMigration.php +++ b/lib/Doctrine/DBAL/Migrations/AbstractMigration.php @@ -3,6 +3,7 @@ namespace Doctrine\DBAL\Migrations; use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration as NewAbstractMigration; /** * Abstract class for individual migrations to extend from. @@ -11,6 +12,7 @@ * @link www.doctrine-project.org * @since 2.0 * @author Jonathan H. Wage + * @deprecated Please use Doctrine\Migrations\AbstractMigration */ abstract class AbstractMigration { @@ -51,6 +53,10 @@ abstract class AbstractMigration public function __construct(Version $version) { + if ( ! $this instanceof NewAbstractMigration) { + @trigger_error(sprintf('The "%s" class is deprecated since Doctrine Migrations 2.0. Use %s instead.', AbstractMigration::class, NewAbstractMigration::class), E_USER_DEPRECATED); + } + $config = $version->getConfiguration(); $this->version = $version; diff --git a/lib/Doctrine/DBAL/Migrations/Tools/Console/Command/GenerateCommand.php b/lib/Doctrine/DBAL/Migrations/Tools/Console/Command/GenerateCommand.php index e1d631dbdf..578ab177b7 100644 --- a/lib/Doctrine/DBAL/Migrations/Tools/Console/Command/GenerateCommand.php +++ b/lib/Doctrine/DBAL/Migrations/Tools/Console/Command/GenerateCommand.php @@ -24,8 +24,8 @@ class GenerateCommand extends AbstractCommand namespace ; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! diff --git a/lib/Doctrine/Migrations/AbstractMigration.php b/lib/Doctrine/Migrations/AbstractMigration.php new file mode 100644 index 0000000000..acd3347884 --- /dev/null +++ b/lib/Doctrine/Migrations/AbstractMigration.php @@ -0,0 +1,10 @@ + Date: Wed, 6 Jun 2018 21:44:03 +0100 Subject: [PATCH 2/3] Update UPGRADE.md with changes to AbstractMigration --- UPGRADE-1.0.md => UPGRADE.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) rename UPGRADE-1.0.md => UPGRADE.md (83%) diff --git a/UPGRADE-1.0.md b/UPGRADE.md similarity index 83% rename from UPGRADE-1.0.md rename to UPGRADE.md index eb57798a6e..5359670361 100644 --- a/UPGRADE-1.0.md +++ b/UPGRADE.md @@ -1,3 +1,11 @@ +UPGRADE TO 1.8 +============== + +## AbstractMigration + +The `Doctrine\DBAL\Migrations\AbstractMigration` class has been deprecated and replaced with +`Doctrine\Migrations\AbstractMigration`. It will be removed in 2.0 so please update to use the class in the new namespace. + UPGRADE FROM 1.0-alpha1 to 1.0.0-alpha3 ======================================= @@ -13,27 +21,27 @@ It would cause discrepancies between the file order in a file browser and the or 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. - + ## --write-sql option from the migrate command ### Before: - + The `--write-sql` option would only output sql contained in the migration and would not update the table containing the migrated migrations. - + ### After: - + 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 ### Before: - + `MigrationsVersion::VERSION` used to be a property. The returned value was fanciful. - + ### After: - + 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. From f0bb055b9083553b4c10b10a83131b36418fbb0c Mon Sep 17 00:00:00 2001 From: "Jonathan H. Wage" Date: Wed, 6 Jun 2018 21:47:40 +0100 Subject: [PATCH 3/3] Remove CHANGELOG.md as we are using github releases and milestones which contain this information. --- CHANGELOG.md | 158 --------------------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 983caa976a..0000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,158 +0,0 @@ -# Change Log -All notable changes to this project will be documented in this file. -This project adheres to [Semantic Versioning](http://semver.org/). - -## [1.6.1] - 2017-11-18 - -### Fixed - - [572: Only show generated migration in verbose mode](https://github.com/doctrine/migrations/pull/572) - @alcaeus - -## [1.6.0] - 2017-11-09 - -### Fixed - - [536: Fix typo in exception message](https://github.com/doctrine/migrations/pull/536) - @mantiz - - [545: Allow nullable custom template](https://github.com/doctrine/migrations/pull/545) - @PapsOu - - [560: Fix `--dry-run` and `--write-sql` with `addSql`](https://github.com/doctrine/migrations/pull/560) - @mikeSimonson - - [569: Allow using absolute paths for custom template](https://github.com/doctrine/migrations/pull/569) - @alcaeus - -### Changed - - [537: Require PHP 7.1](https://github.com/doctrine/migrations/pull/537) - @lcobucci - - [563: Remove copyright headers](https://github.com/doctrine/migrations/pull/563) - @mikeSimonson - - [534: Change RecursiveRegexFinder to follow Symlinks](https://github.com/doctrine/migrations/pull/534) - @burci - -### Added - - [506: Add migration events](https://github.com/doctrine/migrations/pull/506) - @chrisguitarguy - - [509: Add delta in migrate command](https://github.com/doctrine/migrations/pull/509) - @Safranil - - [535: Allow changing migration class template in generate command](https://github.com/doctrine/migrations/pull/535) - @PapsOu - - [542: Enable phpcs to ensure coding style](https://github.com/doctrine/migrations/pull/542) - @lcobucci - - [562: Allow providing a path for file dump](https://github.com/doctrine/migrations/pull/562) - @mikeSimonson - - [565: Allow Symfony 4](https://github.com/doctrine/migrations/565) - @weaverryan - - [568: Add `ConfigurationHelperInterface` to allow overriding internal class](https://github.com/doctrine/migrations/pull/568) - @alcaeus - - [571: Allow changing migration class template in diff command](https://github.com/doctrine/migrations/pull/571) - @alcaeus - -## [1.5.0] - 2016-12-25 - -### Fixed - - [447: Fix typo in error code](https://github.com/doctrine/migrations/pull/447) thanks to @funivan - - [448: Removed unused import](https://github.com/doctrine/migrations/pull/448) thanks to @localheinz - - [451: Case insensitive method calls and types](https://github.com/doctrine/migrations/pull/451) thanks to @localheinz - - [449: Use the class keyword](https://github.com/doctrine/migrations/pull/449) thanks to @localheinz - - [453: Use better assertions](https://github.com/doctrine/migrations/pull/453) thanks to @localheinz - - [452: Fix the visibility of the AbstractTest](https://github.com/doctrine/migrations/pull/452) thanks to @localheinz - - [450: Use the short array syntax](https://github.com/doctrine/migrations/pull/450) thanks to @localheinz - - [464: Clean the github autogenerated zip archive](https://github.com/doctrine/migrations/pull/464) thanks to @mlocati - - [457: Fix an issue where the migration wheren't sorted propely](https://github.com/doctrine/migrations/pull/457) thanks to @JHGitty, @Charles68 - - [451: Case insensitive method calls and types](https://github.com/doctrine/migrations/pull/451) thanks to @localheinz - - [471: Fix loading the configuration from a php file](https://github.com/doctrine/migrations/pull/471) thanks to @aaa2000 - - [451: Case insensitive method calls and types](https://github.com/doctrine/migrations/pull/451) thanks to @localheinz - - [472: Change comment marker a cross platform one ](https://github.com/doctrine/migrations/pull/472) thanks to @aaa2000 - - [476: Add test for the execute command](https://github.com/doctrine/migrations/pull/476) thanks to @chrisguitarguy - - [470: Case insensitive method calls and types](https://github.com/doctrine/migrations/pull/470) thanks to @abacaphiliac - - [489: Better help message in the execute command](https://github.com/doctrine/migrations/pull/489) thanks to @eko - - [500: Updating the dev dependencies](https://github.com/doctrine/migrations/pull/500) thanks to @mikeSimonson - - [501: Fix a bug in a rarely used message call](https://github.com/doctrine/migrations/pull/501) thanks to @Seldaek - -### Changed - - [478: Changed the default generated version number to UTC](https://github.com/doctrine/migrations/pull/446) thanks to @c960657 - - [479: Explicitly connecting to support master slave connections](https://github.com/doctrine/migrations/pull/479) thanks to @chrisguitarguy - - [482: Use strict comparaison in the generated migrations](https://github.com/doctrine/migrations/pull/482) thanks to @tifabien - -### Added - - [470: Add uptodate command](https://github.com/doctrine/migrations/pull/470) thanks to @abacaphiliac - - [477: Add parameters to the output of the dry run migrations](https://github.com/doctrine/migrations/pull/477) thanks to @chrisguitarguy - - [497: Show the content of the generated file on the console](https://github.com/doctrine/migrations/pull/497) thanks to @ErikTrapman - - [480: Don't prompt the user for confirmation when there is nothing to do](https://github.com/doctrine/migrations/pull/480) thanks to @chrisguitarguy - - -## [1.4.1] - 2016-03-14 -### Fixed - - [439: Add missing dependency in the phar build](https://github.com/doctrine/migrations/pull/439) - - -## [1.4.0] - 2016-02-23 -### Added - - [431: Formatted diffs](https://github.com/doctrine/migrations/pull/431) - - [437: Allowing to set the column name from config too](https://github.com/doctrine/migrations/pull/437) - -## [1.3.1] - 2016-02-23 -### Fixed - - [433: Fix: ExecuteCommand by making sure that it autoload the versions](https://github.com/doctrine/migrations/pull/433) - - [434: Fixing an issue in the order at which some configuration key are loaded](https://github.com/doctrine/migrations/pull/434) - -### Changed - - [429: code refactoring for clarity](https://github.com/doctrine/migrations/pull/429) - - [428: code refactoring for clarity](https://github.com/doctrine/migrations/pull/428) - -### Added - - [425: ProxyManager ~2.0 is also compatible with migrations](https://github.com/doctrine/migrations/pull/425) - - -## [1.3.0] - 2016-01-23 -### Fixed - - [421: Fix issue with some method when the migrations were not loaded](https://github.com/doctrine/migrations/pull/421) - - [405: Correcting composer constraints: allowing PHP 7, dropping 5.4 support](https://github.com/doctrine/migrations/pull/405) - - [406: putting the composer.json back in the archive](https://github.com/doctrine/migrations/pull/406) - -### Changed - - [233: Separate Configuration Objects from Configuration File Loading](https://github.com/doctrine/migrations/issues/233) - - [407: Replacing the Schema by a proxy](https://github.com/doctrine/migrations/pull/407) - - [422: Refactor the getConnection into a chainloader](https://github.com/doctrine/migrations/pull/422) - - [Dropped the support for php 5.4](https://github.com/doctrine/migrations/pull/393) - - [Again make the phar more than 3 times smaller](https://github.com/doctrine/migrations/pull/396) - -### Added - - [404: add possibility to read doctrine's config/cli-config.php](https://github.com/doctrine/migrations/pull/404) - - [409: Add a failing test case for an edge case with the write-sql option](https://github.com/doctrine/migrations/pull/409) - - [424: Adding a regression test for the configuration](https://github.com/doctrine/migrations/pull/424) - - [391: Give the possibility to override the Migration template](https://github.com/doctrine/migrations/pull/391) - -## [1.2.2] - 2016-01-07 -### Fixed - - [Fix the write-sql option in the version class too](https://github.com/doctrine/migrations/commit/91043f742da8506ab7115a1d14247ce26375f6f5) - -## [1.2.1] - 2015-12-23 -### Fixed - - [Fix the write-sql option](https://github.com/doctrine/migrations/pull/400) - -## [1.2.0] - 2015-12-15 -### Fixed - - [fix "all migrated versions shown as unavailable executed" ](https://github.com/doctrine/migrations/commit/875849e2a80d37dc8bf5dd0663e464b6789e3b56) - - [Prevent the use of 0 as migration name as it is used internally and conflict](http://github.com/doctrine/migrations/commit/5df49c5ad5dc2265401a54a3b9e6ecb3e7cda8d0) - - [composer: drop symfony/console from suggested packages, since it's required package](http://github.com/doctrine/migrations/commit/d263c7bfac7188009ab0717ed5aa6577e80) - - [fix spaces and complete missing file-docblocks](http://github.com/doctrine/migrations/commit/4b68a69c3e35492b36ec140ebb216cdb80ffe655) - - [RecursiveDirectoryIterator don't obtain some order of the file list.](http://github.com/doctrine/migrations/commit/ed95c05c14381e64404f1135763fcc9b65317b96) - - [Fix the yml parser issue with unescaped backslash in double quoted string](http://github.com/doctrine/migrations/commit/af3cce7d2e490ead821fcbdb54b4772b4913ee1d) - -### Changed - - [Adding compression to the generation of the phar](http://github.com/doctrine/migrations/commit/70730ff8655f0be89ce0f06d1e279930d7eb2550) - - [tests: move autoload of tests to composer](http://github.com/doctrine/migrations/commit/3a4f8368e4b7b95d2e6c51c26f6dc41bb05a5ce5) - - [travis: drop PHP 7.0 from allowed failures, it passes well](http://github.com/doctrine/migrations/commit/57ec2f071a7a840c554058b77f2089893d06ba23) - - [Revert the use of exec to run sql queries](http://github.com/doctrine/migrations/commit/0af6e6e705b905a56cbed26cb5c17faad4c2c04f) - -### Added - - [Adding a little script to prepare and generate the phar](http://github.com/doctrine/migrations/commit/3a8ef413e7f8a42d4e0f3d32d30601b26fb27e60) - - [Configuration: check if migration class exists added](http://github.com/doctrine/migrations/commit/a53d7c83b319341c985d2a21950e260fa55b0b8d) - - [Made composer.json compatible with SF 3.0](http://github.com/doctrine/migrations/commit/4e909f2e661a8414a3e04ce987a09c9e849cd13f) - - [Added configurable version column name](http://github.com/doctrine/migrations/commit/02ddf4318b84a20bb0e3486acfc6e6f41cc63426) - -## [1.1.0] - 2015-09-29 -### Fixed - - [Switch unexisting tag to ](http://github.com/doctrine/migrations/commit/93a81ff0dcc858de4df5c17d97f2f24b3bfa3c36) - - [Ensure that Yaml::parse return an array as it can apparently return a string](http://github.com/doctrine/migrations/commit/1499f0cc3e5f5b20a510ba8f0779d5c68a9e5084) - - [Avoid uploading code coverage to Scrutinizer for HHVM and PHP 7](http://github.com/doctrine/migrations/commit/d47d65021dcb711480bf27f6d0bbba138e220f12) - - [Improve the Travis configuration by persisting the composer cache](http://github.com/doctrine/migrations/commit/bda0509b479ae6605b8fa749b0999b4ce2ff8c04) - - [Keep the license file in the downloadable archives](https://github.com/doctrine/migrations/commit/dfbee38e004899bc078d5d47b13bea53799fca1e#diff-fc723d30b02a4cca7a534518111c1a66) - -### Changed - - [Use short array syntax](http://github.com/doctrine/migrations/commit/50a6e18c95ff617325229a4a649d65c1a11445bc) - - [composer: use PSR-4 autoload](http://github.com/doctrine/migrations/commit/7fb8d301b2f4d4a564433165e0604b7d34013844) - - [refactoring the configuration loading](http://github.com/doctrine/migrations/commit/e95b277111c74cfe65eb959d4471f45a815e1ece) - - [Drop support for php 5.3](https://github.com/doctrine/migrations/commit/0e60856a10e8b510daa612fe25f6245aece77e68) - - [compressing the phar so that it's half the size now](https://github.com/doctrine/migrations/commit/70730ff8655f0be89ce0f06d1e279930d7eb2550) - -### Added - - [Added the ability to auto create migrations in a folder by month and year](http://github.com/doctrine/migrations/commit/0b8e40868e12a36de7f689add61857b9ba29c4bc) - - [Set default name for configuration helper](http://github.com/doctrine/migrations/commit/1f3592f2f126a022db275192f17b8d5c01f19822) - - [Added ability to load config from php array or json files.](http://github.com/doctrine/migrations/commit/8cf01d623f9eb3728ba86c22970347107a8f0be7) - - [Added the possibility to inject the OutputWriter after instantiation](https://github.com/doctrine/migrations/pull/342) - - [Added the --allow-no-migration option to avoid throwing an exception if no migrations are found](https://github.com/doctrine/migrations/commit/a9ec86faa3a3f7f592a633af43b6ef6c9f358239#diff-0a4648a19ba565cda76b349e89552a9b)