2019-12-18 19:08:01 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require_relative '../../migration_helpers'
|
|
|
|
|
|
|
|
module RuboCop
|
|
|
|
module Cop
|
|
|
|
module Migration
|
|
|
|
class AddColumnWithDefault < RuboCop::Cop::Cop
|
|
|
|
include MigrationHelpers
|
|
|
|
|
2020-05-15 11:08:04 -04:00
|
|
|
MSG = '`add_column_with_default` is deprecated, use `add_column` instead'.freeze
|
2019-12-27 13:08:12 -05:00
|
|
|
|
2019-12-18 19:08:01 -05:00
|
|
|
def on_send(node)
|
|
|
|
return unless in_migration?(node)
|
|
|
|
|
2020-05-15 11:08:04 -04:00
|
|
|
name = node.children[1]
|
2019-12-18 19:08:01 -05:00
|
|
|
|
2020-05-15 11:08:04 -04:00
|
|
|
add_offense(node, location: :selector) if name == :add_column_with_default
|
2019-12-18 19:08:01 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|