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

Fixed - Running migration on Rails 5 #40

Open
olivierIllogika opened this issue Jan 27, 2020 · 1 comment
Open

Fixed - Running migration on Rails 5 #40

olivierIllogika opened this issue Jan 27, 2020 · 1 comment

Comments

@olivierIllogika
Copy link

Hi,
On a fresh install of Redmine with the following:

Redmine version                4.0.4.stable
Ruby version                   2.5.5-p157 (2019-03-15) [x86_64-linux-gnu]
Rails version                  5.2.2.1

We ran into errors when running the migration command
bundle exec rake redmine:plugins:migrate RAILS_ENV=production

First error was:

  Message from application: undefined method `to_prepare' for ActionDispatch::Callbacks:Class
Did you mean?  to_param (NoMethodError)
  /usr/share/redmine/plugins/redmine_default_assign/init.rb:12:in `<top (required)>'

which was fixed by replacing (in init.rb):

- ActionDispatch::Callbacks.to_prepare
+ ActiveSupport::Reloader.to_prepare

(there's probably a better way to do this using a Rails::VERSION::MAJOR check)

Second error was:

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

  class AddDefaultAssigneeToProject < ActiveRecord::Migration[4.2]
/usr/share/rubygems-integration/all/gems/activerecord-5.2.2.1/lib/active_record/migration.rb:528:in `inherited'
/usr/share/redmine/plugins/redmine_default_assign/db/migrate/001_add_default_assignee_to_project.rb:1:in `<top (required)>'

which was fixed by adding [5.0] in db/migrate/001_add_default_assignee_to_project.rb:
class AddDefaultAssigneeToProject < ActiveRecord::Migration[5.0]

@giddie
Copy link
Owner

giddie commented Jan 28, 2020

Thanks; would you mind doing a pull request for this?

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