diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-06-12 15:45:19 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-06-12 15:45:19 +0200 |
commit | 98cacae101e73b24cc4fd11fb8e1daf3fdc6de45 (patch) | |
tree | 39991d69bf13a75bec1709c618b8f573a555494f /activerecord/lib/active_record/connection_adapters | |
parent | 0158f9261f0f3d7be5bb5974ceef96bcf862766a (diff) | |
parent | a186663b3d274b7aa648683f3fdf7a816fe90763 (diff) | |
download | rails-98cacae101e73b24cc4fd11fb8e1daf3fdc6de45.tar.gz rails-98cacae101e73b24cc4fd11fb8e1daf3fdc6de45.tar.bz2 rails-98cacae101e73b24cc4fd11fb8e1daf3fdc6de45.zip |
Merge pull request #20226 from EpicH0liday/reversible-remove-foreign-key
Make remove_foreign_key reversible
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 dd7dcb9cdd..c8be038d76 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -777,7 +777,10 @@ module ActiveRecord execute schema_creation.accept(at) end - # Removes the given foreign key from the table. + # Removes the given foreign key from the table. Any option parameters provided + # will be used to re-add the foreign key in case of a migration rollback. + # It is recommended that you provide any options used when creating the foreign + # key so that the migration can be reverted properly. # # Removes the foreign key on +accounts.branch_id+. # @@ -791,6 +794,7 @@ module ActiveRecord # # remove_foreign_key :accounts, name: :special_fk_name # + # The +options+ hash accepts the same keys as SchemaStatements#add_foreign_key. def remove_foreign_key(from_table, options_or_to_table = {}) return unless supports_foreign_keys? |