aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/ar_schema_test.rb
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-08-16 05:08:06 -0300
committerGitHub <noreply@github.com>2016-08-16 05:08:06 -0300
commit3e9070e645147b1a73013633002d27002b3a1f4f (patch)
tree7fb47dde8d111b53ae32661788bc617f16437b82 /activerecord/test/cases/ar_schema_test.rb
parent3fc0bbf008f0e935ab56559f119c9ea8250bfddd (diff)
parent9b3f32914af3c419c6869b2adb038b4d248be928 (diff)
downloadrails-3e9070e645147b1a73013633002d27002b3a1f4f.tar.gz
rails-3e9070e645147b1a73013633002d27002b3a1f4f.tar.bz2
rails-3e9070e645147b1a73013633002d27002b3a1f4f.zip
Merge pull request #26019 from agrobbin/schema-load-unique-column-indices
Support multiple indexes on the same column when loading the schema
Diffstat (limited to 'activerecord/test/cases/ar_schema_test.rb')
-rw-r--r--activerecord/test/cases/ar_schema_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb
index a4919c913d..e3eccad71f 100644
--- a/activerecord/test/cases/ar_schema_test.rb
+++ b/activerecord/test/cases/ar_schema_test.rb
@@ -17,6 +17,7 @@ if ActiveRecord::Base.connection.supports_migrations?
@connection.drop_table :nep_fruits rescue nil
@connection.drop_table :nep_schema_migrations rescue nil
@connection.drop_table :has_timestamps rescue nil
+ @connection.drop_table :multiple_indexes rescue nil
ActiveRecord::SchemaMigration.delete_all rescue nil
ActiveRecord::Migration.verbose = @original_verbose
end
@@ -93,6 +94,21 @@ if ActiveRecord::Base.connection.supports_migrations?
assert_equal "20131219224947", ActiveRecord::SchemaMigration.normalize_migration_number("20131219224947")
end
+ def test_schema_load_with_multiple_indexes_for_column_of_different_names
+ ActiveRecord::Schema.define do
+ create_table :multiple_indexes do |t|
+ t.string "foo"
+ t.index ["foo"], name: "multiple_indexes_foo_1"
+ t.index ["foo"], name: "multiple_indexes_foo_2"
+ end
+ end
+
+ indexes = @connection.indexes("multiple_indexes")
+
+ assert_equal 2, indexes.length
+ assert_equal ["multiple_indexes_foo_1", "multiple_indexes_foo_2"], indexes.collect(&:name).sort
+ end
+
def test_timestamps_without_null_set_null_to_false_on_create_table
ActiveRecord::Schema.define do
create_table :has_timestamps do |t|