Show error message when uncommited migrations are found

This commit is contained in:
Marcin Kucharski 2013-06-12 12:41:12 +02:00
commit 6c2a2bf565

View file

@ -47,8 +47,16 @@ EOT
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->callPhing('diff');
$this->writeSummary($output, 'propel-sql-diff');
if (true === $this->callPhing('diff')) {
$this->writeSummary($output, 'propel-sql-diff');
} elseif ( strpos( $this->buffer, 'Uncommitted migrations have been found' ) ) {
$this->writeSection($output, array(
'[Propel] Error',
'',
'Uncommitted migrations have been found. You should either execute or delete them before rerunning the propel:migration:generate-diff command.'
), 'fg=white;bg=red');
} else {
$this->writeTaskError($output, 'propel-sql-diff');
}
}
}