diff options
author | Scott Barron <scott@elitists.net> | 2005-12-20 21:43:47 +0000 |
---|---|---|
committer | Scott Barron <scott@elitists.net> | 2005-12-20 21:43:47 +0000 |
commit | 88bb279df7d2f4c1b4c48be98fbbbae859b20847 (patch) | |
tree | 95e259b5e129d9b31d10f0f944bf0bcc874b4cbe /activerecord/test | |
parent | 581f12b7b18a6e5205bfabb814f6e9997bf92be8 (diff) | |
download | rails-88bb279df7d2f4c1b4c48be98fbbbae859b20847.tar.gz rails-88bb279df7d2f4c1b4c48be98fbbbae859b20847.tar.bz2 rails-88bb279df7d2f4c1b4c48be98fbbbae859b20847.zip |
Fix change_column to work with postgres 7.x and 8.x.
Closes #3141
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3327 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/migration_test.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb index 3fa680b94a..8d8deb8026 100644 --- a/activerecord/test/migration_test.rb +++ b/activerecord/test/migration_test.rb @@ -31,7 +31,7 @@ if ActiveRecord::Base.connection.supports_migrations? Person.connection.remove_column("people", "administrator") rescue nil Person.reset_column_information end - + def test_add_index Person.connection.add_column "people", "last_name", :string Person.connection.add_column "people", "administrator", :boolean @@ -258,8 +258,15 @@ if ActiveRecord::Base.connection.supports_migrations? end def test_change_column - Person.connection.add_column "people", "bio", :string - assert_nothing_raised { Person.connection.change_column "people", "bio", :text } + Person.connection.add_column 'people', 'age', :integer + old_columns = Person.connection.columns(Person.table_name, "#{name} Columns") + assert old_columns.find { |c| c.name == 'age' and c.type == :integer } + + assert_nothing_raised { Person.connection.change_column "people", "age", :string } + + new_columns = Person.connection.columns(Person.table_name, "#{name} Columns") + assert_nil new_columns.find { |c| c.name == 'age' and c.type == :integer } + assert new_columns.find { |c| c.name == 'age' and c.type == :string } end def test_change_column_with_new_default |