Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Directly inheriting from ActiveRecord::Migration is not supported

I just finished my first Ruby on Rails app, and I'm trying to deploy it to Heroku. I am now at the final step, but when I run the following command (heroku run rake db:migrate), I am getting this error :

StandardError : Directly inheriting from ActiveRecord::Migration is not supported. 
Please specify the Rails release the migration was written for.

Everyone on the web is saying that you just have to change

class CreateRelationships < ActiveRecord::Migration

to

class CreateRelationships < ActiveRecord::Migration[4.2]

The problem is that this solution doesn't work for me. Thank you in advance!

like image 251
ElonTheFreemason Avatar asked Nov 08 '22 21:11

ElonTheFreemason


1 Answers

Add [5.1] if your ruby rails version is [5.1.5] even...just 5.1 class CreateRelationships < ActiveRecord::Migration[5.1]

like in this thread. Check in gemfile at the very top to see what version of rails you have.

I ran bundle install straight afters and and I ran the command that originally showed this error and it worked then worked. Not sure you need to run bundle install though..

Hope this helps Sput

like image 67
user3132726 Avatar answered Nov 15 '22 05:11

user3132726