Project

General

Profile

Actions

Defect #26610

closed

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

Added by Go MAEDA over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Plugin API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
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.2ClosedJean-Philippe Lang

Actions
Actions

Also available in: Atom PDF