debian-mirror-gitlab/rubocop/cop/migration/add_column_with_default.rb

24 lines
532 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
require_relative '../../migration_helpers'
module RuboCop
module Cop
module Migration
class AddColumnWithDefault < RuboCop::Cop::Cop
include MigrationHelpers
2020-05-24 23:13:21 +05:30
MSG = '`add_column_with_default` is deprecated, use `add_column` instead'.freeze
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
2020-05-24 23:13:21 +05:30
add_offense(node, location: :selector) if name == :add_column_with_default
2020-03-13 15:44:24 +05:30
end
end
end
end
end