diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-05-12 17:28:45 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-05-12 17:28:45 +0200 |
commit | 096be96db894854a199ce8cf9a8edeca0f203966 (patch) | |
tree | a8515782cd8f5a8e211c23390745a171970915af /activerecord/test/cases | |
parent | 711af752342cdd558f5f82d407d0d56a115bb8bc (diff) | |
download | rails-096be96db894854a199ce8cf9a8edeca0f203966.tar.gz rails-096be96db894854a199ce8cf9a8edeca0f203966.tar.bz2 rails-096be96db894854a199ce8cf9a8edeca0f203966.zip |
pg, `change_column_default` accepts `[]`. Closes #11586.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/array_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb index 18dd4a6de8..d7d536c79d 100644 --- a/activerecord/test/cases/adapters/postgresql/array_test.rb +++ b/activerecord/test/cases/adapters/postgresql/array_test.rb @@ -61,7 +61,7 @@ class PostgresqlArrayTest < ActiveRecord::TestCase def test_change_column_with_array @connection.add_column :pg_arrays, :snippets, :string, array: true, default: [] - @connection.change_column :pg_arrays, :snippets, :text, array: true, default: "{}" + @connection.change_column :pg_arrays, :snippets, :text, array: true, default: [] PgArray.reset_column_information column = PgArray.columns.find { |c| c.name == 'snippets' } @@ -80,6 +80,14 @@ class PostgresqlArrayTest < ActiveRecord::TestCase end end + def test_change_column_default_with_array + @connection.change_column_default :pg_arrays, :tags, [] + + PgArray.reset_column_information + column = PgArray.columns_hash['tags'] + assert_equal [], column.default + end + def test_type_cast_array data = '{1,2,3}' oid_type = @column.instance_variable_get('@oid_type').subtype |