title: Add new migrations from Rails engine gem to app via generator
body: <p>I'm building a Rails engine in a ruby gem. It includes some migrations right now that are called when you run:</p>
  
  <pre><code>rails g myengine:install
  </code></pre>
  
  <p>The code in the generator is as follows:</p>
  
  <pre><code>module MyEngine
    module Generators
      class InstallGenerator &lt; ::Rails::Generators::Base
        include Rails::Generators::Migration
  
        source_root File.expand_path('../templates', __FILE__)
  
        # ...
  
        def copy_migrations
          migration_template "migrations/migration1.rb", "db/migrate/migration1.rb"
          migration_template "migrations/migration2.rb", "db/migrate/migration2.rb"
        end
  
        # ...
      end
    end
  end
  </code></pre>
  
  <p>However, if I run <code>rails g myengine:install</code> again, it fails with this error:</p>
  
  <pre><code>Another migration is already named migration1: /Users/jh/Code/Web/demoapp/db/migrate/20130327222221_migration1.rb
  </code></pre>
  
  <p>I want it to just silently ignore the fact that there's already a migration and continue on to the next migration. <strong>What would be the best way to do this?</strong></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Per Dmitry's answer, this was my solution:</p>
  
  <pre><code>  def copy_migrations
      copy_migration "migration1"
      copy_migration "migration2"
    end
  
  protected
  
    def copy_migration(filename)
      if self.class.migration_exists?("db/migrate", "#{filename}")
        say_status("skipped", "Migration #{filename}.rb already exists")
      else
        migration_template "migrations/#{filename}.rb", "db/migrate/#{filename}.rb"
      end
    end
  </code></pre>