Skip to content

Rails/BulkChangeTable triggers on migration up/down methods #1577

@Judahmeek

Description

@Judahmeek

rubocop (1.82.1)
rubocop-ast (1.49.0)
rubocop-rails (2.34.3)
parser (3.3.10.0)

class DeviseInvitableAddToUsers < ActiveRecord::Migration[8.1]
  def up
    change_table :users do |t|
      -snip-
    end
  end

  def down
    change_table :users do |t|
      -snip-
    end
  end
end

triggered the following errors:

db/migrate/20260106230752_devise_invitable_add_to_users.rb:5:5: C: Rails/BulkChangeTable: You can combine alter queries using bulk: true options.
    change_table :users do |t|
    ^^^^^^^^^^^^^^^^^^^
db/migrate/20260106230752_devise_invitable_add_to_users.rb:19:5: C: Rails/BulkChangeTable: You can combine alter queries using bulk: true options.
    change_table :users do |t|
    ^^^^^^^^^^^^^^^^^^^

The cop should allow for one change_table method call for each table under both up & down methods

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions