Skip to content

Commit

Permalink
Remove ForeignKeys module which was introduced at #32299
Browse files Browse the repository at this point in the history
To solve the problem #32299, just enough to introduce
`fk_ignore_pattern` option.

I don't think there is a need to expose these constants.
  • Loading branch information
kamipo committed Apr 2, 2018
1 parent 09b2348 commit bdd42ee
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
1 change: 0 additions & 1 deletion activerecord/lib/active_record.rb
Expand Up @@ -43,7 +43,6 @@ module ActiveRecord
autoload :DatabaseConfigurations
autoload :DynamicMatchers
autoload :Enum
autoload :ForeignKeys
autoload :InternalMetadata
autoload :Explain
autoload :Inheritance
Expand Down
Expand Up @@ -1324,7 +1324,7 @@ def foreign_key_name(table_name, options)
identifier = "#{table_name}_#{options.fetch(:column)}_fk"
hashed_identifier = Digest::SHA256.hexdigest(identifier).first(10)

"#{ActiveRecord::ForeignKeys::PREFIX}_#{hashed_identifier}"
"fk_rails_#{hashed_identifier}"
end
end

Expand Down
12 changes: 0 additions & 12 deletions activerecord/lib/active_record/foreign_keys.rb

This file was deleted.

2 changes: 1 addition & 1 deletion activerecord/lib/active_record/schema_dumper.rb
Expand Up @@ -21,7 +21,7 @@ class SchemaDumper #:nodoc:
# :singleton-method:
# Specify a custom regular expression matching foreign keys which name
# should not be dumped to db/schema.rb.
cattr_accessor :fk_ignore_pattern, default: ActiveRecord::ForeignKeys::DEFAULT_IGNORE_PATTERN
cattr_accessor :fk_ignore_pattern, default: /^fk_rails_[0-9a-f]{10}$/

class << self
def dump(connection = ActiveRecord::Base.connection, stream = STDOUT, config = ActiveRecord::Base)
Expand Down

0 comments on commit bdd42ee

Please sign in to comment.