diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-04-02 17:47:35 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-04-02 17:54:26 +0900 |
commit | bdd42eeaf9e1858b10294764aeb99de18cfeef40 (patch) | |
tree | 057509fb58bc5825efe3c0d62a2bbd3f32c7eafe | |
parent | 09b2348f7fc8d4e7191e70e06608c5909067e2aa (diff) | |
download | rails-bdd42eeaf9e1858b10294764aeb99de18cfeef40.tar.gz rails-bdd42eeaf9e1858b10294764aeb99de18cfeef40.tar.bz2 rails-bdd42eeaf9e1858b10294764aeb99de18cfeef40.zip |
Remove `ForeignKeys` module which was introduced at #32299
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.
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) |