aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
authorStefan Kanev <stefan.kanev@gmail.com>2014-08-01 16:13:38 +0200
committerRyuta Kamizono <kamipo@gmail.com>2015-01-19 13:40:13 +0900
commit48e99a45310f5fec515305e90ff8ee2a6a61bada (patch)
treefe3354e0de2cf67944349db3b94ac7a4136ae8ec /activerecord/CHANGELOG.md
parent53919bbfd2b3232ec66e0cdea7b387725653ab43 (diff)
downloadrails-48e99a45310f5fec515305e90ff8ee2a6a61bada.tar.gz
rails-48e99a45310f5fec515305e90ff8ee2a6a61bada.tar.bz2
rails-48e99a45310f5fec515305e90ff8ee2a6a61bada.zip
Add an `:if_exists` option to `drop_table`
If set to `if_exists: true`, it generates a statement like: DROP TABLE IF EXISTS posts This syntax is supported in the popular SQL servers, that is (at least) SQLite, PostgreSQL, MySQL, Oracle and MS SQL Sever. Closes #16366.
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index d8f29a77b4..faa0aecebb 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,18 @@
+* Introduce the `:if_exists` option for `drop_table`.
+
+ Example:
+
+ drop_table(:posts, if_exists: true)
+
+ That would execute:
+
+ DROP TABLE IF EXISTS posts
+
+ If the table doesn't exist, `if_exists: false` (the default) raises an
+ exception whereas `if_exists: true` does nothing.
+
+ *Cody Cutrer*, *Stefan Kanev*, *Ryuta Kamizono*
+
* Don't run SQL if attribute value is not changed for update_attribute method.
*Prathamesh Sonpatki*