2013-10-09 2 views
3

Ruby rake db : Execute db : abort_if_pending_migrations로 인해 시드가 중단되었지만 모든 마이그레이션이 성공적이라고 생각합니다. 내가 갈퀴 DB를 실행하면rake db : migrate 및 rake db : seed가 성공했는지 확인하는 방법

여기에 출력의 마지막 부분이다 : 나는 그것이 성공을 의미 가정 --trace

** Invoke db:load_config (first_time) 
    ** Execute db:load_config 
    ** Execute db:migrate 
    ** Invoke db:_dump (first_time) 
    ** Execute db:_dump 
    ** Invoke db:schema:dump (first_time) 
    ** Invoke environment 
    ** Invoke db:load_config 
    ** Execute db:schema:dump 

마이그레이션 (나는 어떤이 중단 보지 않았다)?

는 그럼 난 갈퀴 DB를 실행하면 내가 (요약) 얻을 --trace 씨 : 다음

** Invoke db:seed (first_time) 
    ** Execute db:seed 
    ** Invoke db:abort_if_pending_migrations (first_time) 
    ** Invoke environment (first_time) 
    ** Execute environment 
    loading plugins 

를 (플러그인이 오류없이로드) :

** Execute db:abort_if_pending_migrations 

이는 뜻 이죠 종자가 제대로 움직 였는가? 시간내어 주셔서 감사합니다 & 입력!

답변

4

중단하지 않은 경우 성공했습니다. 걸릴 look at the code :

# desc "Raises an error if there are pending migrations" 
task :abort_if_pending_migrations => :environment do 
    pending_migrations = ActiveRecord::Migrator.open(ActiveRecord::Migrator.migrations_paths).pending_migrations 

    if pending_migrations.any? 
    puts "You have #{pending_migrations.size} pending #{pending_migrations.size > 1 ? 'migrations:' : 'migration:'}" 
    pending_migrations.each do |pending_migration| 
     puts ' %4d %s' % [pending_migration.version, pending_migration.name] 
    end 
    abort %{Run `rake db:migrate` to update your database then try again.} 
    end 
end 

보류중인 마이그레이션이없는 경우 그것은 문자 그대로 아무것도하지 않습니다.

관련 문제