diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-08 10:35:16 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-08 10:35:16 -0300 |
commit | ba6b3c165f121d080fe59cf227c9823e0bebc186 (patch) | |
tree | bcd857b3ea176f4ee20f90ce377d7a5a71389eef /activerecord/lib/active_record/connection_adapters/abstract | |
parent | 22f31214a01eb5ad39adf18ca3f7c53ae100f971 (diff) | |
parent | b6226c3cfb0344e8973c92bddf8276ff1d26cd08 (diff) | |
download | rails-ba6b3c165f121d080fe59cf227c9823e0bebc186.tar.gz rails-ba6b3c165f121d080fe59cf227c9823e0bebc186.tar.bz2 rails-ba6b3c165f121d080fe59cf227c9823e0bebc186.zip |
Merge pull request #8868 from tehgeekmeister/master
Use the index name explicitly provided in a migration when reverting.
Fixes #8868
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 6 |
1 files changed, 6 insertions, 0 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 5b8de184fe..9d624a6648 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -687,6 +687,12 @@ module ActiveRecord index_name = index_name(table_name, options) unless index_name_exists?(table_name, index_name, true) + if options.has_key? :name + options_without_column = options.dup + options_without_column.delete :column + index_name_without_column = index_name(table_name, options_without_column) + return index_name_without_column if index_name_exists?(table_name, index_name_without_column, false) + end raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' does not exist" end |