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/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/schema_test.rb')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/schema_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb index 2c99fa78bd..7ad03c194f 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb @@ -532,6 +532,34 @@ class SchemaIndexOpclassTest < ActiveRecord::PostgreSQLTestCase end end +class SchemaIndexNullsOrderTest < ActiveRecord::PostgreSQLTestCase + include SchemaDumpingHelper + + setup do + @connection = ActiveRecord::Base.connection + @connection.create_table "trains" do |t| + t.string :name + t.text :description + end + end + + teardown do + @connection.drop_table "trains", if_exists: true + end + + def test_nulls_order_is_dumped + @connection.execute "CREATE INDEX trains_name_and_description ON trains USING btree(name NULLS FIRST, description)" + output = dump_table_schema "trains" + assert_match(/order: \{ name: "NULLS FIRST" \}/, output) + end + + def test_non_default_order_with_nulls_is_dumped + @connection.execute "CREATE INDEX trains_name_and_desc ON trains USING btree(name DESC NULLS LAST, description)" + output = dump_table_schema "trains" + assert_match(/order: \{ name: "DESC NULLS LAST" \}/, output) + end +end + class DefaultsUsingMultipleSchemasAndDomainTest < ActiveRecord::PostgreSQLTestCase setup do @connection = ActiveRecord::Base.connection |