Class: ActiveRecord::ConnectionAdapters::OracleEnhanced::ForeignKeyDefinition

Inherits:
ForeignKeyDefinition
  • Object
show all
Defined in:
lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb

Instance Method Summary collapse

Instance Method Details

#nameObject


15
16
17
18
19
20
21
22
# File 'lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb', line 15

def name
  if options[:name].length > OracleEnhancedAdapter::IDENTIFIER_MAX_LENGTH
    ActiveSupport::Deprecation.warn "Foreign key name #{options[:name]} is too long. It will not get shorten in later version of Oracle enhanced adapter"
    'c'+Digest::SHA1.hexdigest(options[:name])[0,OracleEnhancedAdapter::IDENTIFIER_MAX_LENGTH-1]
  else
    options[:name]
  end
end