Skip to content

Commit

Permalink
Merge pull request #843 from webimpress/hotfix/handle-missing-deps
Browse files Browse the repository at this point in the history
Handle missing jdorn/sql-formatter dependency in dump-schema command
  • Loading branch information
alcaeus authored Jul 30, 2019
2 parents 3e4c335 + c3f2a58 commit fd5f6a6
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

namespace Doctrine\Migrations\Tools\Console\Command;

use Doctrine\Migrations\Tools\Console\Exception\InvalidOptionUsage;
use Doctrine\Migrations\Tools\Console\Exception\SchemaDumpRequiresNoMigrations;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use function class_exists;
use function count;
use function sprintf;

Expand Down Expand Up @@ -73,6 +75,14 @@ public function execute(
throw SchemaDumpRequiresNoMigrations::new();
}

if ($formatted) {
if (! class_exists('SqlFormatter')) {
throw InvalidOptionUsage::new(
'The "--formatted" option can only be used if the sql formatter is installed. Please run "composer require jdorn/sql-formatter".'
);
}
}

$versionNumber = $this->configuration->generateVersionNumber();

$path = $schemaDumper->dump(
Expand Down

0 comments on commit fd5f6a6

Please sign in to comment.