Method: ActiveRecord::Migration::CheckPending#call

Defined in:
activerecord/lib/active_record/migration.rb

#call(env) ⇒ Object



659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
# File 'activerecord/lib/active_record/migration.rb', line 659

def call(env)
  @mutex.synchronize do
    @watcher ||= build_watcher do
      @needs_check = true
      ActiveRecord::Migration.check_pending_migrations
      @needs_check = false
    end

    if @needs_check
      @watcher.execute
    else
      @watcher.execute_if_updated
    end
  end

  @app.call(env)
end