2019-12-18 19:08:01 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require_relative '../../migration_helpers'
|
|
|
|
|
|
|
|
module RuboCop
|
|
|
|
module Cop
|
|
|
|
module Migration
|
2022-09-14 11:12:56 -04:00
|
|
|
class AddColumnWithDefault < RuboCop::Cop::Base
|
2019-12-18 19:08:01 -05:00
|
|
|
include MigrationHelpers
|
|
|
|
|
2021-03-23 11:09:28 -04:00
|
|
|
MSG = '`add_column_with_default` is deprecated, use `add_column` instead'
|
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
|
|
|
|
2022-09-14 11:12:56 -04:00
|
|
|
add_offense(node.loc.selector) if name == :add_column_with_default
|
2019-12-18 19:08:01 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|