提交 69adfc9d 编写于 作者: A Aaron Patterson

Merge pull request #16421 from tsukasaoishi/prevant_manycall_showtables

Tables existence check query is executed in large quantities
......@@ -19,6 +19,7 @@ def primary_keys(table_name)
# A cached lookup for table existence.
def table_exists?(name)
prepare_tables if @tables.empty?
return @tables[name] if @tables.key? name
@tables[name] = connection.table_exists?(name)
......@@ -82,6 +83,12 @@ def marshal_dump
def marshal_load(array)
@version, @columns, @columns_hash, @primary_keys, @tables = array
end
private
def prepare_tables
connection.tables.each { |table| @tables[table] = true }
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册