From 6d505edfa4b46eda2eaa91846c31e1577323b30a Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Fri, 3 Apr 2009 15:58:27 -0400 Subject: [PATCH] Added test case showing change_column from :string to :integer fails on Postgres 8.3.6 --- activerecord/test/cases/migration_test.rb | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 16861f2..07197ee 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -712,6 +712,19 @@ if ActiveRecord::Base.connection.supports_migrations? assert_nothing_raised { Topic.connection.change_column :topics, :approved, :boolean, :default => true } end + def test_change_column_requires_type_cast + Person.connection.add_column 'people', 'age', :string + old_columns = Person.connection.columns(Person.table_name, "#{name} Columns") + assert old_columns.find { |c| c.name == 'age' and c.type == :string } + + assert_nothing_raised { Person.connection.change_column "people", "age", :integer } + + new_columns = Person.connection.columns(Person.table_name, "#{name} Columns") + assert_nil new_columns.find { |c| c.name == 'age' and c.type == :string } + assert new_columns.find { |c| c.name == 'age' and c.type == :integer } + end + + def test_change_column_with_nil_default Person.connection.add_column "people", "contributor", :boolean, :default => true Person.reset_column_information -- 1.5.4.3