drop_table method documentation for mysql and postgresql adapters [ci skip]

This commit is contained in:
Mehmet Emin İNAÇ 2015-04-06 16:12:01 +03:00
parent ca4417d333
commit 1a53549901
2 changed files with 19 additions and 0 deletions

@ -562,6 +562,17 @@ def rename_table(table_name, new_name)
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

@ -87,6 +87,14 @@ def table_exists?(name)
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