aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
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/lib/active_record/connection_adapters/mysql_adapter.rb
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/lib/active_record/connection_adapters/mysql_adapter.rb')
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/mysql_adapter.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index 9f38dabdcc..d56e1f90da 100755
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -258,6 +258,10 @@ module ActiveRecord
def create_table(name, options = {}) #:nodoc:
super(name, {:options => "ENGINE=InnoDB"}.merge(options))
end
+
+ def rename_table(name, new_name)
+ execute "RENAME TABLE #{name} TO #{new_name}"
+ end
def change_column_default(table_name, column_name, default) #:nodoc:
current_type = select_one("SHOW COLUMNS FROM #{table_name} LIKE '#{column_name}'")["Type"]