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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
525 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
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
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