2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require_relative '../../migration_helpers'
|
|
|
|
|
|
|
|
module RuboCop
|
|
|
|
module Cop
|
|
|
|
module Migration
|
2022-10-11 01:57:18 +05:30
|
|
|
class AddColumnWithDefault < RuboCop::Cop::Base
|
2020-03-13 15:44:24 +05:30
|
|
|
include MigrationHelpers
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
MSG = '`add_column_with_default` is deprecated, use `add_column` instead'
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
def on_send(node)
|
|
|
|
return unless in_migration?(node)
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
name = node.children[1]
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
add_offense(node.loc.selector) if name == :add_column_with_default
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|