class RuboCop::Cop::Rails::UnusedIgnoredColumns


end
self.ignored_columns = [:still_existing_column]
class User < ApplicationRecord
# good
end
self.ignored_columns = [:already_removed_column]
class User < ApplicationRecord
# bad
@example
if you know your migrations will be run before any of your Rails applications boot with the modified code.
the column, which can lead to downtime when the migration is actually executed. Only enable this cop
this cop can cause ‘ignored_columns` to be removed even though the production schema still contains
and production schema can be out of sync until the migration has been run on production. As such,
IMPORTANT: This cop can’t be used to effectively check for unused columns because the development
to drop the column. You avoid forgetting to remove ‘ignored_columns` by this cop.
`ignored_columns` is necessary to drop a column from RDBMS, but you don’t need it after the migration
Suggests you remove a column that does not exist in the schema from ‘ignored_columns`.

def check_column_existence(column_node, table)

def check_column_existence(column_node, table)
  column_name = column_name(column_node)
  return unless column_name
  return if table.with_column?(name: column_name.to_s)
  message = format(MSG, column_name: column_name)
  add_offense(column_node, message: message)
end

def class_node(node)

def class_node(node)
  node.each_ancestor.find(&:class_type?)
end

def on_send(node)

def on_send(node)
  return unless (columns = ignored_columns(node) || appended_ignored_columns(node))
  return unless schema
  table = table(node)
  return unless table
  columns.children.each do |column_node|
    check_column_existence(column_node, table)
  end
end

def table(node)

def table(node)
  klass = class_node(node)
  return unless klass
  schema.table_by(name: table_name(klass))
end