aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorfatkodima <fatkodima123@gmail.com>2018-03-16 07:19:40 +0200
committerRafael França <rafaelmfranca@gmail.com>2018-03-16 01:19:40 -0400
commit471bec310d1ecc50311f18b545df1d789d6bac0d (patch)
tree44d83b4a877fa20211e3376f3cf92c79fc3e6b0e /activerecord/test
parent81843bcf65f1f5fce0bab1d1437e2815eb20e904 (diff)
downloadrails-471bec310d1ecc50311f18b545df1d789d6bac0d.tar.gz
rails-471bec310d1ecc50311f18b545df1d789d6bac0d.tar.bz2
rails-471bec310d1ecc50311f18b545df1d789d6bac0d.zip
Fix multiline expression indexes for postgresql (#31621)
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb2
-rw-r--r--activerecord/test/schema/schema.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index a612ce9bb2..50d766a99e 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -298,7 +298,7 @@ class SchemaDumperTest < ActiveRecord::TestCase
def test_schema_dump_expression_indices
index_definition = dump_table_schema("companies").split(/\n/).grep(/t\.index.*company_expression_index/).first.strip
- assert_equal 't.index "lower((name)::text)", name: "company_expression_index"', index_definition
+ assert_match %r{CASE.+lower\(\(name\)::text\)}i, index_definition
end
def test_schema_dump_interval_type
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index 8b0106dbf0..ca86100bc5 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -210,7 +210,7 @@ ActiveRecord::Schema.define do
t.index [:firm_id, :type, :rating], name: "company_index", length: { type: 10 }, order: { rating: :desc }
t.index [:firm_id, :type], name: "company_partial_index", where: "(rating > 10)"
t.index :name, name: "company_name_index", using: :btree
- t.index "lower(name)", name: "company_expression_index" if supports_expression_index?
+ t.index "(CASE WHEN rating > 0 THEN lower(name) END)", name: "company_expression_index" if supports_expression_index?
end
create_table :content, force: true do |t|