Search code examples
ruby-on-railsrubymacos-sierradbmigrate

rake db:migrate StandardError macOS


I'm getting a so called 'StandardError' when I run rake db:migrate. I ran this command:

rake db:migrate 

And got this 'StandardError' in a Mac Terminal

Screenshot of error in Mac Terminal


Solution

  • Go through all your migration files in db/migrate and change this line:

    class XYZ < ActiveRecord::Migration
    

    to look like this instead:

    class XYZ < ActiveRecord::Migration[5.0]
    

    I'm assuming you're working with an old / poorly maintained app. If you're generating migrations yourself and they're not automatically including [5.0] at the end, then you should probably open a second question to figure that part out.