diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2015-04-06 10:49:26 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2015-04-06 10:49:26 -0300 |
commit | 060ee2c6c94cf7050bd8be22c79e053fd602579d (patch) | |
tree | e7c13ba36776996d9cbab0266c0d7d46bd677d77 /activerecord | |
parent | 2c16acde0dd75e77d38b25b1254d4cffc14e81a6 (diff) | |
parent | 1a535499016ca9455a5537e1f2e720239493a598 (diff) | |
download | rails-060ee2c6c94cf7050bd8be22c79e053fd602579d.tar.gz rails-060ee2c6c94cf7050bd8be22c79e053fd602579d.tar.bz2 rails-060ee2c6c94cf7050bd8be22c79e053fd602579d.zip |
Merge pull request #19667 from vngrs/drop_table_doc
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.rb | 11 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb | 8 |
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 |