aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-04-06 16:12:01 +0300
committerMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-04-06 16:15:15 +0300
commit1a535499016ca9455a5537e1f2e720239493a598 (patch)
treef4dc7d7a666cee3d7873a09efe243ef769dc0357 /activerecord
parentca4417d333292b5d345cc64d3e4bbff1b491e8e3 (diff)
downloadrails-1a535499016ca9455a5537e1f2e720239493a598.tar.gz
rails-1a535499016ca9455a5537e1f2e720239493a598.tar.bz2
rails-1a535499016ca9455a5537e1f2e720239493a598.zip
drop_table method documentation for mysql and postgresql adapters [ci skip]
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb11
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb8
2 files changed, 19 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
index b7c7ff1187..51c41cd588 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -562,6 +562,17 @@ module ActiveRecord
rename_table_indexes(table_name, new_name)
end
+ # Drops a table from the database.
+ #
+ # [<tt>:force</tt>]
+ # Set to +:cascade+ to drop dependent objects as well.
+ # Defaults to false.
+ # [<tt>:if_exists</tt>]
+ # Set to +true+ to make drop table command fail safe when table does not exists.
+ # Defaults to false.
+ # [<tt>:temporary</tt>]
+ # Set to +true+ to drop temporary table.
+ # Defaults to false.
def drop_table(table_name, options = {})
execute "DROP#{' TEMPORARY' if options[:temporary]} TABLE#{' IF EXISTS' if options[:if_exists]} #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}"
end
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
index c048d570e8..652ae1ed63 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
@@ -87,6 +87,14 @@ module ActiveRecord
SQL
end
+ # Drops a table from the database.
+ #
+ # [<tt>:force</tt>]
+ # Set to +:cascade+ to drop dependent objects as well.
+ # Defaults to false.
+ # [<tt>:if_exists</tt>]
+ # Set to +true+ to make drop table command fail safe when table does not exists.
+ # Defaults to false.
def drop_table(table_name, options = {})
execute "DROP TABLE#{' IF EXISTS' if options[:if_exists]} #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}"
end