Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directly inheriting from ActiveRecord::Migration is not supported on Rails 5 #22

Closed
norbertszivos opened this issue Mar 23, 2018 · 3 comments

Comments

@norbertszivos
Copy link
Contributor

I'm using Rails 5.1.4 with ruby 2.5.0, when run

rake s3_relay:install:migrations db:migrate

got this error:

Copied migration 20180323143543_create_s3_relay_uploads.s3_relay.rb from s3_relay
rake 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 CreateS3RelayUploads < ActiveRecord::Migration[4.2]
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:525:in `inherited'
.../db/migrate/20180323143543_create_s3_relay_uploads.s3_relay.rb:2:in `<top (required)>'
.../.rvm/gems/ruby-2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
.../.rvm/gems/ruby-2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
.../.rvm/gems/ruby-2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
.../.rvm/gems/ruby-2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:962:in `load_migration'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:958:in `migration'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:953:in `disable_ddl_transaction'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1305:in `use_transaction?'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1297:in `ddl_transaction'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1229:in `execute_migration_in_transaction'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1201:in `block in migrate_without_lock'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `each'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `migrate_without_lock'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `block in migrate'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1317:in `with_advisory_lock'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `migrate'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1007:in `up'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:985:in `migrate'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
.../.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
.../.rvm/gems/ruby-2.5.0@global/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
.../.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `eval'
.../.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `<main>'

The solution is easy just need to add the missing version as the error message suggested:

class CreateS3RelayUploads < ActiveRecord::Migration[4.2]

but a little bit annoying thing...

@kjohnston
Copy link
Owner

Thanks for opening this, would you mind submitting a pull request?

@norbertszivos
Copy link
Contributor Author

Sure, no problem!

@kjohnston
Copy link
Owner

Fixed via #23, thanks @norbertszivos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants