aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2005-10-06 14:10:45 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2005-10-06 14:10:45 +0000
commitebfddf35b9d4ebcdb5be37df77b83b2e1e16df97 (patch)
treeaabf37727ae0d35131bebbd2df8c877210db06cc /activerecord/test
parent7e70fc1e9d1bd3f1d0be37fcf23dae1736ccbaaa (diff)
downloadrails-ebfddf35b9d4ebcdb5be37df77b83b2e1e16df97.tar.gz
rails-ebfddf35b9d4ebcdb5be37df77b83b2e1e16df97.tar.bz2
rails-ebfddf35b9d4ebcdb5be37df77b83b2e1e16df97.zip
Add rename_table to mysql, sqlite and postgres adapters for use in migrations
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2477 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/migration_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb
index cbcaff8cc4..317ac3720b 100644
--- a/activerecord/test/migration_test.rb
+++ b/activerecord/test/migration_test.rb
@@ -180,6 +180,25 @@ if ActiveRecord::Base.connection.supports_migrations?
end
+ def test_rename_table
+ begin
+ ActiveRecord::Base.connection.create_table :octopuses do |t|
+ t.column :url, :string
+ end
+ ActiveRecord::Base.connection.rename_table :octopuses, :octopi
+
+ assert_nothing_raised do
+ ActiveRecord::Base.connection.execute "INSERT INTO octopi (url) VALUES ('http://www.foreverflying.com/octopus-black7.jpg')"
+ end
+
+ assert_equal 'http://www.foreverflying.com/octopus-black7.jpg', ActiveRecord::Base.connection.select_value("SELECT url FROM octopi WHERE id=1")
+
+ ensure
+ ActiveRecord::Base.connection.drop_table :octopuses rescue nil
+ ActiveRecord::Base.connection.drop_table :octopi rescue nil
+ end
+ end
+
def test_change_column
Person.connection.add_column "people", "bio", :string
assert_nothing_raised { Person.connection.change_column "people", "bio", :text }