rails/rails — pull request #17632 by eugeneius (2014-11-15 20:23:34+00:00)
Title: Apply schema cache dump when creating connections

The `db:schema:cache:dump` rake task dumps the database schema structure to `db/schema_cache.dump`. If this file is present, the schema details are loaded into the currently checked out connection by a railtie while Rails is booting, to avoid having to query the database for its schema.

The schema cache dump is only applied to the initial connection used to boot the application though; other connections from the same pool are created with an empty schema cache, and still have to load the structure of each table directly from the database.

With this change, a copy of the schema cache is associated with the connection pool and applied to connections as they are created.