diff options
author | Sebastian Martinez <sebastian@wyeworks.com> | 2011-04-22 20:26:20 -0300 |
---|---|---|
committer | Sebastian Martinez <sebastian@wyeworks.com> | 2011-04-22 20:26:20 -0300 |
commit | e382d95e1e491c48f583d2bf13a9f50d7b3ee6ef (patch) | |
tree | 2646e548aedbecccb5a60f24a82bb3b0cf70d070 /activerecord/lib | |
parent | 5d59cd8d6a8181cafa55af6189e0984b618e19be (diff) | |
download | rails-e382d95e1e491c48f583d2bf13a9f50d7b3ee6ef.tar.gz rails-e382d95e1e491c48f583d2bf13a9f50d7b3ee6ef.tar.bz2 rails-e382d95e1e491c48f583d2bf13a9f50d7b3ee6ef.zip |
Added docs for #rename_table on some adapters
Diffstat (limited to 'activerecord/lib')
3 files changed, 11 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 381995b1b6..6342504f83 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -640,6 +640,10 @@ module ActiveRecord super(table_name, options.reverse_merge(:options => "ENGINE=InnoDB")) end + # Renames a table. + # + # Example: + # rename_table('octopuses', 'octopi') def rename_table(table_name, new_name) execute "RENAME TABLE #{quote_table_name(table_name)} TO #{quote_table_name(new_name)}" end diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index d6beb67c4d..9f9b40e108 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -855,6 +855,9 @@ module ActiveRecord end # Renames a table. + # + # Example: + # rename_table('octopuses', 'octopi') def rename_table(name, new_name) execute "ALTER TABLE #{quote_table_name(name)} RENAME TO #{quote_table_name(new_name)}" end diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 90f20c15b5..afb768c6a0 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -284,6 +284,10 @@ module ActiveRecord exec_query "DROP INDEX #{quote_column_name(index_name)}" end + # Renames a table. + # + # Example: + # rename_table('octopuses', 'octopi') def rename_table(name, new_name) exec_query "ALTER TABLE #{quote_table_name(name)} RENAME TO #{quote_table_name(new_name)}" end |