title: How can you check if there are migrations while running a deploy using deployer
body: <p>I'm using Deployer to deploy my Symfony application to production. All is working fine, however, my deploy.php file has the command for database migrations:</p>
  
  <pre><code>/**
  * Run a diff to generate migrations, 
  */
  task('database:diff', function () {
  
  run('{{bin/php}} {{release_path}}/' . trim(get('bin_dir'), '/') . '/console doctrine:migrations:diff --env={{env}} --no-debug --no-interaction');
  
  })-&gt;desc('Generate migrations database');
  
  ...
  
  after('deploy:symlink','database:diff');
  after('database:diff','database:migrate');
  </code></pre>
  
  <p>But if there are no changes to the database then this step causes an error.</p>
  
  <p>Error message:</p>
  
  <pre><code>[RuntimeException]                                                                                                                                                                                      
  
  [Doctrine\DBAL\Migrations\MigrationException]                                                                                                                                                         
  Could not find any migrations to execute.
  </code></pre>
  
  <p>I'm looking for some code that can check for any database change and only conditionally run the migrations tasks if there are changes.</p>