diff options
author | Adam Anderson <adamandersonis@gmail.com> | 2013-05-05 22:06:12 -0400 |
---|---|---|
committer | Adam Anderson <adamandersonis@gmail.com> | 2013-06-04 00:18:59 -0400 |
commit | e4fe4973cf43ecd5279b376ac847181259a92678 (patch) | |
tree | 8af97a977dd78601f6a1929cf100b22461d7f7a4 /activerecord/test/cases/migration | |
parent | 424fa92b35231a4217574e8012d96a0954659cde (diff) | |
download | rails-e4fe4973cf43ecd5279b376ac847181259a92678.tar.gz rails-e4fe4973cf43ecd5279b376ac847181259a92678.tar.bz2 rails-e4fe4973cf43ecd5279b376ac847181259a92678.zip |
Fixes #10432 add_column not creating array columns in PostgreSQL
When then PostgreSQL visitor was [added](https://github.com/rails/rails/commit/6b7fdf3bf3675a14eae74acc5241089308153a34)
`add_column` was no longer receiving the column options directly. This
caused the options to be lost along the way.
Diffstat (limited to 'activerecord/test/cases/migration')
-rw-r--r-- | activerecord/test/cases/migration/change_schema_test.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/change_schema_test.rb b/activerecord/test/cases/migration/change_schema_test.rb index 54fff8a0f5..e37dca856d 100644 --- a/activerecord/test/cases/migration/change_schema_test.rb +++ b/activerecord/test/cases/migration/change_schema_test.rb @@ -74,6 +74,35 @@ module ActiveRecord assert_equal "hello", five.default unless mysql end + def test_add_column_with_array + if current_adapter?(:PostgreSQLAdapter) + connection.create_table :testings + connection.add_column :testings, :foo, :string, :array => true + + columns = connection.columns(:testings) + array_column = columns.detect { |c| c.name == "foo" } + + assert array_column.array + else + skip "array option only supported in PostgreSQLAdapter" + end + end + + def test_create_table_with_array_column + if current_adapter?(:PostgreSQLAdapter) + connection.create_table :testings do |t| + t.string :foo, :array => true + end + + columns = connection.columns(:testings) + array_column = columns.detect { |c| c.name == "foo" } + + assert array_column.array + else + skip "array option only supported in PostgreSQLAdapter" + end + end + def test_create_table_with_limits connection.create_table :testings do |t| t.column :foo, :string, :limit => 255 |