diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/ExecuteCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/ExecuteCommand.php index 3893f2370e..63b83938dc 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/ExecuteCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/ExecuteCommand.php @@ -105,7 +105,10 @@ protected function execute(InputInterface $input, OutputInterface $output) : int $migratorConfigurationFactory = $this->getDependencyFactory()->getConsoleInputMigratorConfigurationFactory(); $migratorConfiguration = $migratorConfigurationFactory->getMigratorConfiguration($input); - $question = 'WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue?'; + $question = sprintf( + 'WARNING! You are about to execute a migration in database "%s" that could result in schema changes and data loss. Are you sure you wish to continue?', + $this->getDependencyFactory()->getConnection()->getDatabase() ?? '' + ); if (! $migratorConfiguration->isDryRun() && ! $this->canExecute($question, $input)) { $this->io->error('Migration cancelled!'); diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php index bcbe45c8da..df5d693070 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php @@ -121,7 +121,10 @@ protected function execute(InputInterface $input, OutputInterface $output) : int $migratorConfigurationFactory = $this->getDependencyFactory()->getConsoleInputMigratorConfigurationFactory(); $migratorConfiguration = $migratorConfigurationFactory->getMigratorConfiguration($input); - $question = 'WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue?'; + $question = sprintf( + 'WARNING! You are about to execute a migration in database "%s" that could result in schema changes and data loss. Are you sure you wish to continue?', + $this->getDependencyFactory()->getConnection()->getDatabase() ?? '' + ); if (! $migratorConfiguration->isDryRun() && ! $this->canExecute($question, $input)) { $this->io->error('Migration cancelled!'); diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/RollupCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/RollupCommand.php index fa114a1d11..b6334a0088 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/RollupCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/RollupCommand.php @@ -37,7 +37,10 @@ protected function configure() : void protected function execute(InputInterface $input, OutputInterface $output) : int { - $question = 'WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue?'; + $question = sprintf( + 'WARNING! You are about to execute a migration in database "%s" that could result in schema changes and data loss. Are you sure you wish to continue?', + $this->getDependencyFactory()->getConnection()->getDatabase() ?? '' + ); if (! $this->canExecute($question, $input)) { $this->io->error('Migration cancelled!'); diff --git a/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php b/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php index 7730500fb5..71a5ec6f91 100644 --- a/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php +++ b/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php @@ -403,7 +403,7 @@ public function testExecuteMigrateCancelExecutedUnavailableMigrations() : void $output = $this->migrateCommandTester->getDisplay(true); self::assertStringContainsString('[WARNING] You have 1 previously executed migrations in the database that are not registered migrations.', $output); - self::assertStringContainsString('WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue?', $output); + self::assertStringContainsString('WARNING! You are about to execute a migration in database "" that could result in schema changes and data loss. Are you sure you wish to continue?', $output); self::assertStringContainsString('[ERROR] Migration cancelled!', $output); self::assertSame(3, $this->migrateCommandTester->getStatusCode()); @@ -423,7 +423,7 @@ public function testExecuteMigrateCancel() : void $output = $this->migrateCommandTester->getDisplay(true); - self::assertStringContainsString('WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue?', $output); + self::assertStringContainsString('WARNING! You are about to execute a migration in database "" that could result in schema changes and data loss. Are you sure you wish to continue?', $output); self::assertStringContainsString('[ERROR] Migration cancelled!', $output); self::assertSame(3, $this->migrateCommandTester->getStatusCode());