Skip to content

Rails/ReversibleMigration - False positive with change_table_comment #144

Closed
@DNA

Description

Rails/ReversibleMigration cop throw an offense even when the method change_table_comment pass a hash with :from and :to

Expected behavior

Only throw an offense if it's not a hash with :from and :to

Actual behavior

db/migrate/20191031164441_add_comments_to_table.rb:5:5: C: Rails/ReversibleMigration: change_table_comment is not reversible.
    change_table_comment :foo, from: 'old_comment', to: 'new_comment'
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Steps to reproduce the problem

Just create a migration with change_table_comment

class AddComentsToPosts < ActiveRecord::Migration[6.0]
  def change
    change_table_comment :foo, from: 'old comment', to: 'new_comment'
  end
end

RuboCop version

$ [bundle exec] rubocop -V
0.76.0 (using Parser 2.6.5.0, running on ruby 2.5.7 x86_64-linux)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions