aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Martinez <sebastian@wyeworks.com>2011-04-22 21:30:30 -0300
committerSebastian Martinez <sebastian@wyeworks.com>2011-04-22 21:30:30 -0300
commit0887385d8e18acda857fccc7f5c97acfec129902 (patch)
treefb896a08d5854ebec06682b705cb8af7c466306a
parent8f1b141b3f766a3a724648b2a9437ee5f18aaad9 (diff)
downloadrails-0887385d8e18acda857fccc7f5c97acfec129902.tar.gz
rails-0887385d8e18acda857fccc7f5c97acfec129902.tar.bz2
rails-0887385d8e18acda857fccc7f5c97acfec129902.zip
Added missing docs to mysql2_adapter
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
index 7ac72acd58..fc91814275 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -131,6 +131,7 @@ module ActiveRecord
ADAPTER_NAME
end
+ # Returns true, since this connection adapter supports migrations.
def supports_migrations?
true
end
@@ -139,6 +140,7 @@ module ActiveRecord
true
end
+ # Returns true, since this connection adapter supports savepoints.
def supports_savepoints?
true
end
@@ -376,6 +378,10 @@ module ActiveRecord
end
end
+ # Drops a MySQL database.
+ #
+ # Example:
+ # drop_database('sebastian_development')
def drop_database(name) #:nodoc:
execute "DROP DATABASE IF EXISTS `#{name}`"
end
@@ -406,6 +412,7 @@ module ActiveRecord
super(table_name, options)
end
+ # Returns an array of indexes for the given table.
def indexes(table_name, name = nil)
indexes = []
current_index = nil
@@ -423,6 +430,7 @@ module ActiveRecord
indexes
end
+ # Returns an array of +Mysql2Column+ objects for the table specified by +table_name+.
def columns(table_name, name = nil)
sql = "SHOW FIELDS FROM #{quote_table_name(table_name)}"
columns = []
@@ -437,6 +445,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
@@ -521,6 +533,7 @@ module ActiveRecord
variables.first['Value'] unless variables.empty?
end
+ # Returns a table's primary key and belonging sequence.
def pk_and_sequence_for(table)
keys = []
result = execute("describe #{quote_table_name(table)}")