diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2018-04-02 10:49:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-02 10:49:13 -0500 |
commit | abb810b90bf25c3316e735d3778275ba5b817dfb (patch) | |
tree | 91a53edf618ea8f3be025930ff0a78642fa6ae8d /activerecord/lib | |
parent | ead8a21a9ebb5feeb73373f5ca91987182550ba0 (diff) | |
parent | bdd42eeaf9e1858b10294764aeb99de18cfeef40 (diff) | |
download | rails-abb810b90bf25c3316e735d3778275ba5b817dfb.tar.gz rails-abb810b90bf25c3316e735d3778275ba5b817dfb.tar.bz2 rails-abb810b90bf25c3316e735d3778275ba5b817dfb.zip |
Merge pull request #32415 from kamipo/remove_foreign_keys_module
Remove `ForeignKeys` module which was introduced at #32299
Diffstat (limited to 'activerecord/lib')
4 files changed, 2 insertions, 15 deletions
diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 0e1f315183..d198466dbf 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -43,7 +43,6 @@ module ActiveRecord autoload :DatabaseConfigurations autoload :DynamicMatchers autoload :Enum - autoload :ForeignKeys autoload :InternalMetadata autoload :Explain autoload :Inheritance diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index ef45fff9d2..e2147b7fcf 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -1324,7 +1324,7 @@ module ActiveRecord 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 diff --git a/activerecord/lib/active_record/foreign_keys.rb b/activerecord/lib/active_record/foreign_keys.rb deleted file mode 100644 index 87ce3ace20..0000000000 --- a/activerecord/lib/active_record/foreign_keys.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -module ActiveRecord - module ForeignKeys - # The prefix used by Rails to name unnamed foreign keys. - PREFIX = "fk_rails" - - # Default regular expression used by Rails to determine if a foreign key - # name was generated. - DEFAULT_IGNORE_PATTERN = /^#{PREFIX}_[0-9a-f]{10}$/ - end -end diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 8fc2752f0c..9974c28445 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -21,7 +21,7 @@ module ActiveRecord # :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) |