rails/rails — pull request #16366 by skanev (2014-08-01 14:29:48+00:00)
Title: Add an :if_exists option to drop_table

I think `drop_table` can benefit from an `if_exists: true` option, that does a `DROP TABLE IF EXISTS`. If nothing else, it can be useful for a bunch of tests that do this manually ([to](https://github.com/rails/rails/blob/master/activerecord/test/cases/migration/rename_table_test.rb#L86-L87) [name](https://github.com/rails/rails/blob/master/activerecord/test/cases/migration/table_and_index_test.rb#L9) [a](https://github.com/rails/rails/blob/master/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb#L19) [few](https://github.com/rails/rails/blob/master/activerecord/test/cases/migration/create_join_table_test.rb#L15)). The `DROP TABLE IF EXISTS` syntax seems to be supported in the popular database engines. I checked MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

I'm not sure if `if_exists` is the best name for this option. Suggesstions are welcome, if you feel that this is a useful contribution.