Rails 6.0 compatibility issues in migrations
rohandaxini opened this issue · 3 comments
Hi @vinistock
While installing sail
in my newer Rails 6.0 application, I faced migration issues after step rails g sail:install
. The errors while running rails db:migrate
is
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 CreateSailSettings < ActiveRecord::Migration[4.2]
...
...
...
...
I fixed it on my local by just inheriting it using ActiveRecord::Migration[6.0]
instead of ActiveRecord::Migration
. i.e. I edited both the migration files for CreateSailSettings
class and CreateSailProfiles
class and inherited them from ActiveRecord::Migration[6.0]
. This now allows me to run the migrations successfully.
Should we start working on to make it Rails 6.0 compatible? 😄
BTW, last year we both collaborated on your sail
gem for one of the features and few fixes.
@vinistock I think the problem is here probably in method migration_version
?
def migration_version
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if Rails.version.start_with?("5")
end
Hey! Thanks for reporting this issue. I tested Sail against a Rails 6.0 application, but I didn't create one from scratch.
You are right, that is the issue. I put together a PR to fix it and will release a new version. Let me know if you find any other problems.
@vinistock Thanks for fixing it quickly.
Sure ill test the gem now and let you know if I face any other problem.