diff options
author | Dan McClain <git@danmcclain.net> | 2013-03-25 13:33:37 -0400 |
---|---|---|
committer | Dan McClain <git@danmcclain.net> | 2013-03-25 17:56:38 -0400 |
commit | e199dc1a570d4f0d9a07628268835bce5aab2732 (patch) | |
tree | 693717ae53d7043907f7c7ae9a0bc13ac14d7831 /activerecord/test/cases/adapters/mysql | |
parent | 1a838ccda4a31bb023985f6c977e6bc3e238cda9 (diff) | |
download | rails-e199dc1a570d4f0d9a07628268835bce5aab2732.tar.gz rails-e199dc1a570d4f0d9a07628268835bce5aab2732.tar.bz2 rails-e199dc1a570d4f0d9a07628268835bce5aab2732.zip |
Adds support for concurrent indexing in PostgreSQL adapter
Adds support for algorithm option in MySQL indexes
Moves USING and algorithm options upstream
The syntax is still specific to the Adapter, so the actual executed string happens
in the corresponding adapter
Diffstat (limited to 'activerecord/test/cases/adapters/mysql')
-rw-r--r-- | activerecord/test/cases/adapters/mysql/active_schema_test.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/activerecord/test/cases/adapters/mysql/active_schema_test.rb b/activerecord/test/cases/adapters/mysql/active_schema_test.rb index 568fd45888..ca6478f6ac 100644 --- a/activerecord/test/cases/adapters/mysql/active_schema_test.rb +++ b/activerecord/test/cases/adapters/mysql/active_schema_test.rb @@ -21,30 +21,33 @@ class ActiveSchemaTest < ActiveRecord::TestCase ActiveRecord::ConnectionAdapters::MysqlAdapter.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) + + 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::MysqlAdapter.send(:remove_method, :index_name_exists?) |