66use Doctrine \DBAL \Version as DbalVersion ;
77use Doctrine \DBAL \Migrations \Provider \OrmSchemaProvider ;
88use Symfony \Component \Console \Input \InputInterface ;
9+ use Symfony \Component \Console \Input \InputOption ;
910use Symfony \Component \Console \Output \OutputInterface ;
1011use Symfony \Component \Filesystem \Filesystem ;
1112use Symfony \Component \Finder \Finder ;
1617 */
1718class DiffFileCommand extends \Doctrine \DBAL \Migrations \Tools \Console \Command \DiffCommand
1819{
20+ protected function configure ()
21+ {
22+ parent ::configure ();
23+
24+ $ this ->addOption ('check ' , null , InputOption::VALUE_NONE , 'Check that all migrations have been created. ' )
25+ }
26+
1927 /**
2028 *
2129 * @param InputInterface $input
@@ -40,6 +48,8 @@ public function execute(InputInterface $input, OutputInterface $output)
4048 ->setFilterSchemaAssetsExpression ($ filterExpr );
4149 }
4250
51+ $ checkOnly = $ input ->getOption ('check ' );
52+
4353 $ fromSchema = $ this ->getLastSchemaDefinition ($ configuration );
4454 $ toSchema = $ this ->getSchemaProvider ()->createSchema ();
4555
@@ -62,6 +72,11 @@ public function execute(InputInterface $input, OutputInterface $output)
6272 return ;
6373 }
6474
75+ if ($ checkOnly ) {
76+ $ output ->writeln ('<error>Changes detected in your mapping information!</error> ' );
77+ exit (1 );
78+ }
79+
6580 $ version = date ('YmdHis ' );
6681 $ path = $ this ->generateMigration ($ configuration , $ input , $ version , $ up , $ down );
6782
0 commit comments