Defect #26610

Migration file generated by redmine_plugin_model generator is not compatible with Rails 5.1

Added by Go MAEDA 4 months ago. Updated 4 months ago.

Status:ResolvedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Plugin API
Target version:4.0.0
Resolution: Affected version:

Description

plugins/polls/db/migrate/001_create_polls.rb:
(generated by bin/rails generate redmine_plugin_model polls poll question:string yes:integer no:integer)

class CreatePolls < ActiveRecord::Migration
  def change
    create_table :polls do |t|
      t.string :question
      t.integer :yes
      t.integer :no
    end
  end
end

error:

$ bin/rails redmine:plugins:migrate
Migrating polls (Polls plugin)...
DEPRECATION WARNING: schema_migrations_table_name is deprecated and will be removed from Rails 5.2 (called from current_version at /Users/somebody/redmines/redmine-trunk/lib/redmine/plugin.rb:487)
DEPRECATION WARNING: schema_migrations_table_name is deprecated and will be removed from Rails 5.2 (called from migrated at /Users/somebody/redmines/redmine-trunk/lib/redmine/plugin.rb:493)
DEPRECATION WARNING: schema_migrations_table_name is deprecated and will be removed from Rails 5.2 (called from migrated at /Users/somebody/redmines/redmine-trunk/lib/redmine/plugin.rb:493)
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 CreatePolls < ActiveRecord::Migration[4.2]
/Users/somebody/redmines/gems/ruby/2.4.0/gems/activerecord-5.1.2/lib/active_record/migration.rb:525:in `inherited'
/Users/somebody/redmines/redmine-trunk/plugins/polls/db/migrate/001_create_polls.rb:1:in `<top (required)


Related issues

Related to Redmine - Feature #23630: Migrate to Rails 5.1 Closed

Associated revisions

Revision 16945
Added by Jean-Philippe Lang 4 months ago

Set migration version in the plugin migration template (#26610).

History

#1 Updated by Jean-Philippe Lang 4 months ago

#2 Updated by Jean-Philippe Lang 4 months ago

  • Status changed from New to Resolved

This should be fixed by r16945.

#3 Updated by Go MAEDA 4 months ago

Jean-Philippe Lang wrote:

This should be fixed by r16945.

Thanks, I confirmed that it has been fixed.

Also available in: Atom PDF