diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-26 07:18:21 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-26 07:18:21 -0700 |
commit | 2d33796457b139a58539c890624591c97354d334 (patch) | |
tree | dd43c9a7a61bc3bb6f90f0414ebf3d9860931949 /activerecord/test/cases/adapters/mysql2 | |
parent | 078bfbffa41e29a9d8ff2cf56e4c9254e7260f24 (diff) | |
parent | 203e0e0e4a863a25fedfe6985b371c3f4cfc6839 (diff) | |
download | rails-2d33796457b139a58539c890624591c97354d334.tar.gz rails-2d33796457b139a58539c890624591c97354d334.tar.bz2 rails-2d33796457b139a58539c890624591c97354d334.zip |
Merge pull request #9923 from danmcclain/psql-concurrent-indexes
Adds support for concurrent indexing in PostgreSQL adapter
Diffstat (limited to 'activerecord/test/cases/adapters/mysql2')
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/active_schema_test.rb | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb index 273ef978bf..48d63aeef5 100644 --- a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb +++ b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb @@ -21,30 +21,37 @@ class ActiveSchemaTest < ActiveRecord::TestCase ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:define_method, :index_name_exists?) do |*| false end - expected = "CREATE INDEX `index_people_on_last_name` ON `people` (`last_name`)" + expected = "CREATE INDEX `index_people_on_last_name` ON `people` (`last_name`) " assert_equal expected, add_index(:people, :last_name, :length => nil) - expected = "CREATE INDEX `index_people_on_last_name` ON `people` (`last_name`(10))" + expected = "CREATE INDEX `index_people_on_last_name` ON `people` (`last_name`(10)) " assert_equal expected, add_index(:people, :last_name, :length => 10) - expected = "CREATE INDEX `index_people_on_last_name_and_first_name` ON `people` (`last_name`(15), `first_name`(15))" + expected = "CREATE INDEX `index_people_on_last_name_and_first_name` ON `people` (`last_name`(15), `first_name`(15)) " assert_equal expected, add_index(:people, [:last_name, :first_name], :length => 15) - expected = "CREATE INDEX `index_people_on_last_name_and_first_name` ON `people` (`last_name`(15), `first_name`)" + expected = "CREATE INDEX `index_people_on_last_name_and_first_name` ON `people` (`last_name`(15), `first_name`) " assert_equal expected, add_index(:people, [:last_name, :first_name], :length => {:last_name => 15}) - expected = "CREATE INDEX `index_people_on_last_name_and_first_name` ON `people` (`last_name`(15), `first_name`(10))" + expected = "CREATE INDEX `index_people_on_last_name_and_first_name` ON `people` (`last_name`(15), `first_name`(10)) " assert_equal expected, add_index(:people, [:last_name, :first_name], :length => {:last_name => 15, :first_name => 10}) %w(btree hash).each do |type| - expected = "CREATE INDEX `index_people_on_last_name` USING #{type} ON `people` (`last_name`)" + expected = "CREATE INDEX `index_people_on_last_name` USING #{type} ON `people` (`last_name`) " assert_equal expected, add_index(:people, :last_name, :using => type) end - expected = "CREATE INDEX `index_people_on_last_name` USING btree ON `people` (`last_name`(10))" + expected = "CREATE INDEX `index_people_on_last_name` USING btree ON `people` (`last_name`(10)) " assert_equal expected, add_index(:people, :last_name, :length => 10, :using => :btree) - expected = "CREATE INDEX `index_people_on_last_name_and_first_name` USING btree ON `people` (`last_name`(15), `first_name`(15))" + expected = "CREATE INDEX `index_people_on_last_name` USING btree ON `people` (`last_name`(10)) ALGORITHM = COPY" + assert_equal expected, add_index(:people, :last_name, :length => 10, using: :btree, algorithm: :copy) + + assert_raise ArgumentError do + add_index(:people, :last_name, algorithm: :coyp) + end + + expected = "CREATE INDEX `index_people_on_last_name_and_first_name` USING btree ON `people` (`last_name`(15), `first_name`(15)) " assert_equal expected, add_index(:people, [:last_name, :first_name], :length => 15, :using => :btree) ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:remove_method, :index_name_exists?) |