mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Prevent multiple SHOW TABLES calls when a table don't exists in database.
This commit is contained in:
@@ -123,14 +123,14 @@ module ActiveRecord
|
||||
|
||||
# A cached lookup for table existence.
|
||||
def table_exists?(name)
|
||||
return true if @tables.key? name
|
||||
return @tables[name] if @tables.key? name
|
||||
|
||||
with_connection do |conn|
|
||||
conn.tables.each { |table| @tables[table] = true }
|
||||
@tables[name] = true if !@tables.key?(name) && conn.table_exists?(name)
|
||||
@tables[name] = !@tables.key?(name) && conn.table_exists?(name)
|
||||
end
|
||||
|
||||
@tables.key? name
|
||||
@tables[name]
|
||||
end
|
||||
|
||||
# Clears out internal caches:
|
||||
|
||||
Reference in New Issue
Block a user