Class: RuboCop::Cop::Bugcrowd::UuidColumnRequired

Inherits:
Cop
  • Object
show all
Includes:
Database
Defined in:
lib/rubocop/cop/bugcrowd/uuid_column_required.rb

Constant Summary collapse

MSG =
"\\nNew tables should all have a uuid column of type uuid \\n\nExample: `t.uuid :uuid, null: false, default: 'gen_random_uuid()', index { unique: true }`\nThis is a temporary cop to help with the uuid migration:\\n\nhttps://github.com/bugcrowd/crowdcontrol/pull/8730\n"

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



20
21
22
23
24
25
# File 'lib/rubocop/cop/bugcrowd/uuid_column_required.rb', line 20

def on_send(node)
  if within_change_or_up_method?(node) && create_table?(node) &&
     !create_table_with_uuid_pk?(node) && !create_table_with_uuid_column?(node.parent)
    add_offense(node)
  end
end