From ebfddf35b9d4ebcdb5be37df77b83b2e1e16df97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Thu, 6 Oct 2005 14:10:45 +0000 Subject: 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 --- activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/lib/active_record/connection_adapters/mysql_adapter.rb') 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"] -- cgit v1.2.3