diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-12-13 23:43:42 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-12-13 23:46:26 +0000 |
commit | 38703ac8972c7e8f3f3f1ac95aa506cc4ae30ef0 (patch) | |
tree | 5cc1bc40fa363bea7719e1e23ecdba8a8b3f945d /activerecord/lib/active_record/connection_adapters/abstract | |
parent | c7552d988e5dec76d6c515a86f73701b647aa784 (diff) | |
download | rails-38703ac8972c7e8f3f3f1ac95aa506cc4ae30ef0.tar.gz rails-38703ac8972c7e8f3f3f1ac95aa506cc4ae30ef0.tar.bz2 rails-38703ac8972c7e8f3f3f1ac95aa506cc4ae30ef0.zip |
Revert naive O(1) table_exists? implementation.
It was a bad idea to rescue exceptions here. This can interfere with
transaction rollbacks which seems to be the cause of current CI
failure.
Instead, each adapter should implement its own DB-specific O(1)
implementation, and we fall back on the generic, slower, implementation
otherwise.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index a905c135f8..ccbeba061d 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -16,17 +16,12 @@ module ActiveRecord table_name[0...table_alias_length].gsub(/\./, '_') end - # def tables(name = nil) end - # Checks to see if the table +table_name+ exists on the database. # # === Example # table_exists?(:developers) def table_exists?(table_name) - select_value("SELECT 1 FROM #{quote_table_name(table_name)} where 1=0", 'SCHEMA') - true - rescue - false + tables.include?(table_name.to_s) end # Returns an array of indexes for the given table. |