Rails Executing migration ArgumentError

后端 未结 2 1581
眼角桃花
眼角桃花 2021-01-24 18:37

I\'m having a strange problem executing rake db:migrate

== 20141127213559 CreateMovies: migrating =====================================
-- create_table(:movies)         


        
相关标签:
2条回答
  • 2021-01-24 19:04

    Maybe you should execute this after create movies table:

    generate migration AddFieldsToMovies newfield:type
    

    This generates the correct migration, see this:

    http://edgeguides.rubyonrails.org/active_record_migrations.html#changing-tables

    0 讨论(0)
  • 2021-01-24 19:11

    If you are using Rails 4.2.0.beta4, ActiveRecord will require arel gem. Add the following to your gem file

    gem 'arel', '6.0.0.beta2'
    

    and run

    bundle install
    

    You may get below error message

    You have requested:arel = 6.0.0.beta2
    
    The bundle currently has arel locked at 6.0.0.
    Try running `bundle update arel`
    

    then

    bundle update arel
    

    Now you should able to run migration.

    Here you may find similar and explanatory answer: Can't migrate database after scaffold. Section 2.2 Ruby on Rails Tutorial Michael Hartl

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