diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-01-20 13:14:24 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-01-20 13:14:24 +0100 |
commit | 6b2be718f69e73eb960a08898db517fc2f301df6 (patch) | |
tree | 677875f24112b67c87bce1bf67a45effb69231c4 /activerecord/test | |
parent | 04d1c3716b5bfa133a0b1ed937649a0829ac5f22 (diff) | |
parent | 48e99a45310f5fec515305e90ff8ee2a6a61bada (diff) | |
download | rails-6b2be718f69e73eb960a08898db517fc2f301df6.tar.gz rails-6b2be718f69e73eb960a08898db517fc2f301df6.tar.bz2 rails-6b2be718f69e73eb960a08898db517fc2f301df6.zip |
Merge pull request #18597 from kamipo/add-if-exists-to-drop-table
Add an `:if_exists` option to `drop_table`
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/migration/change_schema_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/change_schema_test.rb b/activerecord/test/cases/migration/change_schema_test.rb index b3129a8984..c84e65effc 100644 --- a/activerecord/test/cases/migration/change_schema_test.rb +++ b/activerecord/test/cases/migration/change_schema_test.rb @@ -403,6 +403,17 @@ module ActiveRecord end end + def test_drop_table_if_exists + connection.create_table(:testings) + assert connection.table_exists?(:testings) + connection.drop_table(:testings, if_exists: true) + assert_not connection.table_exists?(:testings) + end + + def test_drop_table_if_exists_nothing_raised + assert_nothing_raised { connection.drop_table(:nonexistent, if_exists: true) } + end + private def testing_table_with_only_foo_attribute connection.create_table :testings, :id => false do |t| |