Skip to content

Directly inheriting from ActiveRecord::Migration is not supported #444

@brandoncordell

Description

@brandoncordell

Rails: 5.1.0.beta1
Ruby: 2.4.0
Rolify: 5.1.0

This generated migration fails on this version of rails

  class RolifyCreateRoles < ActiveRecord::Migration
    def change
      ...
    end
  end
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 RolifyCreateRoles < ActiveRecord::Migration[4.2]
/Users/brandoncordell/Code/dsk_group/db/migrate/20170307143104_rolify_create_roles.rb:1:in `<top (required)>'
/Users/brandoncordell/Code/dsk_group/bin/rails:9:in `require'
/Users/brandoncordell/Code/dsk_group/bin/rails:9:in `<top (required)>'
/Users/brandoncordell/Code/dsk_group/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
StandardError: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:

  class RolifyCreateRoles < ActiveRecord::Migration[4.2]
/Users/brandoncordell/Code/dsk_group/db/migrate/20170307143104_rolify_create_roles.rb:1:in `<top (required)>'
/Users/brandoncordell/Code/dsk_group/bin/rails:9:in `require'
/Users/brandoncordell/Code/dsk_group/bin/rails:9:in `<top (required)>'
/Users/brandoncordell/Code/dsk_group/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Solution: I change class RolifyCreateRoles < ActiveRecord::Migration to class RolifyCreateRoles < ActiveRecord::Migration[5.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions