aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/schema_dumper_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-10-25 07:29:51 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-10-25 18:09:02 +0900
commitd496055b5b75387136bcdd1cc93aeab14dbda606 (patch)
tree232e12f4d7b3800386f51fb09c5387699b84f8b1 /activerecord/test/cases/schema_dumper_test.rb
parentd76d66fb554fc3267de93d780344815d05ae6533 (diff)
downloadrails-d496055b5b75387136bcdd1cc93aeab14dbda606.tar.gz
rails-d496055b5b75387136bcdd1cc93aeab14dbda606.tar.bz2
rails-d496055b5b75387136bcdd1cc93aeab14dbda606.zip
Support expression indexes for MySQL
MySQL 8.0.13 and higher supports functional key parts that index expression values rather than column or column prefix values. https://dev.mysql.com/doc/refman/8.0/en/create-index.html
Diffstat (limited to 'activerecord/test/cases/schema_dumper_test.rb')
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index db13f20a39..dda3efa47c 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -229,11 +229,14 @@ class SchemaDumperTest < ActiveRecord::TestCase
if ActiveRecord::Base.connection.supports_expression_index?
def test_schema_dump_expression_indices
index_definition = dump_table_schema("companies").split(/\n/).grep(/t\.index.*company_expression_index/).first.strip
+ index_definition.sub!(/, name: "company_expression_index"\z/, "")
if current_adapter?(:PostgreSQLAdapter)
- assert_match %r{CASE.+lower\(\(name\)::text\)}i, index_definition
+ assert_match %r{CASE.+lower\(\(name\)::text\).+END\) DESC"\z}i, index_definition
+ elsif current_adapter?(:Mysql2Adapter)
+ assert_match %r{CASE.+lower\(`name`\).+END\) DESC"\z}i, index_definition
elsif current_adapter?(:SQLite3Adapter)
- assert_match %r{CASE.+lower\(name\)}i, index_definition
+ assert_match %r{CASE.+lower\(name\).+END\) DESC"\z}i, index_definition
else
assert false
end