I typed in rails db:migrate
and received the following error. I googled and someone said something like changing the Migration version from [4.2] to [5.1] but it still has not worked.
rails db:migrate rails aborted! StandardError: An error has occurred, this and all later migrations canceled:
Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:
class CreateCkeditorAssets < ActiveRecord::Migration[4.2]
Aditya already wrote the answer, Changing all migrations by hand is a hectic task, So I wrote a one liner script to do that
In linux (Gnu sed)
grep -rl "ActiveRecord::Migration$" db | xargs sed -i 's/ActiveRecord::Migration/ActiveRecord::Migration[4.2]/g'
In Mac (BSD sed)
grep -rl "ActiveRecord::Migration$" db | xargs sed -i "" "s/ActiveRecord::Migration/ActiveRecord::Migration[4.2]/g"
Note, you can replace 4.2
with the rails from which you are upgrading to 5.1