diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php
index b7f3dccae19..b4618b3df48 100644
--- a/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php
+++ b/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php
@@ -10,6 +10,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
+use function count;
use function sprintf;
/**
@@ -76,6 +77,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
$ui->text('[SKIPPED] The database was not checked for synchronicity.');
} elseif (! $validator->schemaInSyncWithMetadata()) {
$ui->error('The database schema is not in sync with the current mapping file.');
+
+ if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
+ $updates = $validator->getUpdateSchemaList();
+
+ $rows = [];
+ foreach ($updates as $idx => $sql) {
+ $rows[] = [(int) $idx + 1, $sql];
+ }
+
+ $ui->comment(sprintf('%d schema diff(s) detected:', count($updates)));
+ $ui->table(['n°', 'SQL'], $rows);
+ }
+
$exit += 2;
} else {
$ui->success('The database schema is in sync with the mapping files.');
diff --git a/lib/Doctrine/ORM/Tools/SchemaValidator.php b/lib/Doctrine/ORM/Tools/SchemaValidator.php
index 194e7fd59f9..a9cd443eb65 100644
--- a/lib/Doctrine/ORM/Tools/SchemaValidator.php
+++ b/lib/Doctrine/ORM/Tools/SchemaValidator.php
@@ -261,11 +261,21 @@ public function validateClass(ClassMetadataInfo $class)
* @return bool
*/
public function schemaInSyncWithMetadata()
+ {
+ return count($this->getUpdateSchemaList()) === 0;
+ }
+
+ /**
+ * Returns the list of missing Database Schema updates.
+ *
+ * @return string[]
+ */
+ public function getUpdateSchemaList()
{
$schemaTool = new SchemaTool($this->em);
$allMetadata = $this->em->getMetadataFactory()->getAllMetadata();
- return count($schemaTool->getUpdateSchemaSql($allMetadata, true)) === 0;
+ return $schemaTool->getUpdateSchemaSql($allMetadata, true);
}
}