diff options
author | fatkodima <fatkodima123@gmail.com> | 2018-01-25 22:11:11 +0200 |
---|---|---|
committer | fatkodima <fatkodima123@gmail.com> | 2018-01-28 18:37:52 +0200 |
commit | b7b3e20333056fcec4725b3f87659acbcd214ee4 (patch) | |
tree | cdfb5b9d842e6b6ac6dcb9bfbfd02d4af868dbcb /activerecord/test/cases/adapters/postgresql/active_schema_test.rb | |
parent | a88eb9087260cca256c6faba40bf538d4a0289b3 (diff) | |
download | rails-b7b3e20333056fcec4725b3f87659acbcd214ee4.tar.gz rails-b7b3e20333056fcec4725b3f87659acbcd214ee4.tar.bz2 rails-b7b3e20333056fcec4725b3f87659acbcd214ee4.zip |
Dump correctly index nulls order for postgresql
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/active_schema_test.rb')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/active_schema_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb index 99c53dadeb..308ad1d854 100644 --- a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb @@ -62,6 +62,12 @@ class PostgresqlActiveSchemaTest < ActiveRecord::PostgreSQLTestCase expected = %(CREATE INDEX "index_people_on_last_name" ON "people" USING gist ("last_name" bpchar_pattern_ops)) assert_equal expected, add_index(:people, :last_name, using: :gist, opclass: { last_name: :bpchar_pattern_ops }) + expected = %(CREATE INDEX "index_people_on_last_name_and_first_name" ON "people" ("last_name" DESC NULLS LAST, "first_name" ASC)) + assert_equal expected, add_index(:people, [:last_name, :first_name], order: { last_name: "DESC NULLS LAST", first_name: :asc }) + + expected = %(CREATE INDEX "index_people_on_last_name" ON "people" ("last_name" NULLS FIRST)) + assert_equal expected, add_index(:people, :last_name, order: "NULLS FIRST") + assert_raise ArgumentError do add_index(:people, :last_name, algorithm: :copy) end |