Show pending migrations in rails

前端 未结 10 1000
北海茫月
北海茫月 2020-12-22 22:25

Is there a rake task that shows the pending migrations in a rails app?

相关标签:
10条回答
  • 2020-12-22 22:48

    This works for rails 5.2

    ActiveRecord::Base.connection.migration_context.needs_migration?
    
    0 讨论(0)
  • 2020-12-22 22:52

    rake db:version will accomplish this on Rails 2.

    0 讨论(0)
  • 2020-12-22 22:53

    rake db:migrate:status (Rails 3 to 5) or rails db:migrate:status (Rails 5) will accomplish this. See this commit.

    up means the migration has been run. down means the migration has not been run.

    0 讨论(0)
  • 2020-12-22 22:54

    Try rake -h (help) and have a look at rake -n (= rake --dry-run). So probably something like rake -n db:migrate should get you what you want.

    0 讨论(0)
提交回复
热议问题