rails/rails — pull request #3867 by jadeforrest (2011-12-05 19:27:00+00:00)
Title: Increase performance for table_exists?

At New Relic, we have hundreds of thousands of tables, and our migrations took 30 minutes without a similar patch. This cuts it down to a more reasonable amount of time. The more tables you have, the more efficiency gain you derive from the patch.

The rescue false part is ugly, but necessary as far as I can tell. I don't know of a cross-database statement you can make that will work without trapping and relying on errors.

Tested on MySQL and SQLite, but I believe this should work across any database.