From 1ee9873e073a1fee275b06efbabb2a179c339e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Tue, 14 Mar 2023 23:56:15 +0100 Subject: [PATCH 1/7] build: Update Box --- download-box.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download-box.sh b/download-box.sh index f83399312..f7df01333 100755 --- a/download-box.sh +++ b/download-box.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash if [ ! -f box.phar ]; then - wget https://github.com/box-project/box/releases/download/3.16.0/box.phar -O box.phar + wget https://github.com/box-project/box/releases/download/4.3.7/box.phar -O box.phar fi From ea824901f282480b12fb5639f9a38e9718218baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 22 Mar 2023 12:28:42 +0100 Subject: [PATCH 2/7] Trigger the build on download script change --- .github/workflows/continuous-integration.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index d335766b3..6c67f221e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -7,6 +7,7 @@ on: paths: - .github/workflows/continuous-integration.yml - composer.* + - download-box.sh - lib/** - phpunit.xml.dist - tests/** @@ -16,6 +17,7 @@ on: paths: - .github/workflows/continuous-integration.yml - composer.* + - download-box.sh - lib/** - phpunit.xml.dist - tests/** From 024b307f49f701ea3cc5c9e0e52543475ee1ce9e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 11 Sep 2023 12:40:47 +0200 Subject: [PATCH 3/7] Allow Symfony 7 (#1361) --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index f90f14576..ec89e8e46 100644 --- a/composer.json +++ b/composer.json @@ -30,9 +30,9 @@ "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.2 || ^2.0", "psr/log": "^1.1.3 || ^2 || ^3", - "symfony/console": "^5.4 || ^6.0", - "symfony/stopwatch": "^5.4 || ^6.0", - "symfony/var-exporter": "^6.2" + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0", + "symfony/var-exporter": "^6.2 || ^7.0" }, "require-dev": { "ext-pdo_sqlite": "*", @@ -46,9 +46,9 @@ "phpstan/phpstan-strict-rules": "^1.4", "phpstan/phpstan-symfony": "^1.3", "phpunit/phpunit": "^10.3", - "symfony/cache": "^5.4 || ^6.0", - "symfony/process": "^5.4 || ^6.0", - "symfony/yaml": "^5.4 || ^6.0" + "symfony/cache": "^5.4 || ^6.0 || ^7.0", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "conflict": { "doctrine/orm": "<2.12" From 5038099da818718703586804cc5bf890aec9086f Mon Sep 17 00:00:00 2001 From: Agustin Gomes Date: Sun, 15 Jan 2023 18:22:00 +0100 Subject: [PATCH 4/7] Deprecate using `--all-or-nothing` with values During the iteration of the PR https://github.com/doctrine/migrations/pull/1296 an idea to deprecate passing values to this option was suggested, given how complicated was to handle using that option without any value, which led to a bug and inconsistency with the documentation. As specified in the deprecation message, using this option from 4.0.x onwards in the CLI will be treated as `true`, and the option itself won't accept values. --- UPGRADE.md | 9 ++++++++ ...nsoleInputMigratorConfigurationFactory.php | 23 +++++++++++++++---- .../Console/Command/MigrateCommandTest.php | 15 +++++++++--- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 91ead5afb..728c6074b 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,3 +1,12 @@ +# Upgrade to 3.6 + +## Console +- The `--all-or-nothing` option for `migrations:migrate` does not accept a value anymore, and passing it a + value will generate a deprecation. Specifying `--all-or-nothing` will wrap all the migrations to be + executed into a single transaction, regardless of the specified configuration. + + + # Upgrade to 3.1 - The "version" is the FQCN of the migration class (existing entries in the migrations table will be automatically updated). diff --git a/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php b/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php index ec7e6c93d..eff014dd2 100644 --- a/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php +++ b/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php @@ -4,6 +4,7 @@ namespace Doctrine\Migrations\Tools\Console; +use Doctrine\Deprecations\Deprecation; use Doctrine\Migrations\Configuration\Configuration; use Doctrine\Migrations\MigratorConfiguration; use Symfony\Component\Console\Input\InputInterface; @@ -28,16 +29,30 @@ public function getMigratorConfiguration(InputInterface $input): MigratorConfigu private function determineAllOrNothingValueFrom(InputInterface $input): bool|null { - if (! $input->hasOption('all-or-nothing')) { - return null; + $allOrNothingOption = null; + $wasOptionExplicitlyPassed = $input->hasOption('all-or-nothing'); + + if ($wasOptionExplicitlyPassed) { + $allOrNothingOption = $input->getOption('all-or-nothing'); } - $allOrNothingOption = $input->getOption('all-or-nothing'); + if ($wasOptionExplicitlyPassed && $allOrNothingOption !== null) { + Deprecation::trigger( + 'doctrine/migrations', + 'https://github.com/doctrine/migrations/issues/1304', + <<<'DEPRECATION' + Context: Passing values to option `--all-or-nothing` + Problem: Passing values is deprecated + Solution: From version 4.0.x, `--all-or-nothing` option won't accept any value, + and the presence of the option will be treated as `true`. + DEPRECATION, + ); + } if ($allOrNothingOption === 'notprovided') { return null; } - return (bool) ($allOrNothingOption ?? true); + return (bool) ($allOrNothingOption ?? false); } } diff --git a/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php b/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php index 5b2be79ef..d0dd54da3 100644 --- a/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php +++ b/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php @@ -6,6 +6,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Types\Types; +use Doctrine\Deprecations\PHPUnit\VerifyDeprecations; use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\Configuration\Configuration; use Doctrine\Migrations\Configuration\Connection\ExistingConnection; @@ -42,6 +43,8 @@ class MigrateCommandTest extends MigrationTestCase { + use VerifyDeprecations; + private DependencyFactory $dependencyFactory; private Configuration $configuration; private CommandTester $migrateCommandTester; @@ -340,7 +343,7 @@ public function testExecuteMigrateDown(): void * * @dataProvider allOrNothing */ - public function testExecuteMigrateAllOrNothing(bool $default, array $input, bool $expected): void + public function testExecuteMigrateAllOrNothing(bool $default, array $input, bool $expected, bool $expectDeprecation = true): void { $migrator = $this->createMock(DbalMigrator::class); $this->dependencyFactory->setService(Migrator::class, $migrator); @@ -355,6 +358,12 @@ public function testExecuteMigrateAllOrNothing(bool $default, array $input, bool return ['A']; }); + if ($expectDeprecation) { + $this->expectDeprecationWithIdentifier( + 'https://github.com/doctrine/migrations/issues/1304', + ); + } + $this->migrateCommandTester->execute( $input, ['interactive' => false], @@ -363,7 +372,7 @@ public function testExecuteMigrateAllOrNothing(bool $default, array $input, bool self::assertSame(0, $this->migrateCommandTester->getStatusCode()); } - /** @psalm-return Generator, bool}> */ + /** @psalm-return Generator, 2: bool, 3?: bool}> */ public static function allOrNothing(): Generator { yield [false, ['--all-or-nothing' => false], false]; @@ -373,7 +382,7 @@ public static function allOrNothing(): Generator yield [false, ['--all-or-nothing' => true], true]; yield [false, ['--all-or-nothing' => 1], true]; yield [false, ['--all-or-nothing' => '1'], true]; - yield [false, ['--all-or-nothing' => null], true]; + yield [false, ['--all-or-nothing' => null], false, false]; yield [true, ['--all-or-nothing' => false], false]; yield [true, ['--all-or-nothing' => 0], false]; From 799f16d458a93aaadaec29012d8b8b425131fa1d Mon Sep 17 00:00:00 2001 From: Agustin Gomes Date: Tue, 10 Oct 2023 15:54:43 +0200 Subject: [PATCH 5/7] Apply PR feedback on the upgrade note --- .../Console/ConsoleInputMigratorConfigurationFactory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php b/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php index eff014dd2..d3673a2e2 100644 --- a/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php +++ b/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php @@ -43,8 +43,8 @@ private function determineAllOrNothingValueFrom(InputInterface $input): bool|nul <<<'DEPRECATION' Context: Passing values to option `--all-or-nothing` Problem: Passing values is deprecated - Solution: From version 4.0.x, `--all-or-nothing` option won't accept any value, - and the presence of the option will be treated as `true`. + Solution: If you need to disable the behavior, omit the option, + otherwise, pass the option without a value DEPRECATION, ); } From 1d2413134d41bb98b9cb8f144279716b174858bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 15 Oct 2023 19:51:54 +0200 Subject: [PATCH 6/7] Use github actions format for BC check (#1364) It is a better experience than having to check the logs. --- .github/workflows/bc-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bc-check.yml b/.github/workflows/bc-check.yml index e412dcfe8..c62302429 100644 --- a/.github/workflows/bc-check.yml +++ b/.github/workflows/bc-check.yml @@ -33,4 +33,4 @@ jobs: run: composer require --dev roave/backward-compatibility-check - name: Run roave/backward-compatibility-check. - run: vendor/bin/roave-backward-compatibility-check + run: vendor/bin/roave-backward-compatibility-check --format=github-actions From f82c18189de489f66f5eaa027e24907abd3793c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 15 Oct 2023 22:19:20 +0200 Subject: [PATCH 7/7] Update to box 4.4.0 --- download-box.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download-box.sh b/download-box.sh index f7df01333..01acbf4b0 100755 --- a/download-box.sh +++ b/download-box.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash if [ ! -f box.phar ]; then - wget https://github.com/box-project/box/releases/download/4.3.7/box.phar -O box.phar + wget https://github.com/box-project/box/releases/download/4.4.0/box.phar -O box.phar fi