Skip to content

Commit 2451a56

Browse files
committed
Update multi-db docs
As of Rails 7+ we added an option to support loading the schema cache for multiple databases.
1 parent 35e79f0 commit 2451a56

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

guides/source/active_record_multiple_databases.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ The following features are not (yet) supported:
3333

3434
* Automatic swapping for horizontal sharding
3535
* Load balancing replicas
36-
* Dumping schema caches for multiple databases
3736

3837
## Setting up your application
3938

@@ -549,6 +548,10 @@ order from one table cannot be applied to another table.
549548
Rails can't guess this for you because association loading is lazy, to load `treats` in `@dog.treats`
550549
Rails already needs to know what SQL should be generated.
551550

551+
### Schema Caching
552+
553+
If you want to load a schema cache for each database you must set a `schema_cache_path` in each database configuration and set `config.active_record.lazily_load_schema_cache = true` in your application configuration. Note that this will lazily load the cache when the database connections are established.
554+
552555
## Caveats
553556

554557
### Automatic swapping for horizontal sharding
@@ -563,9 +566,3 @@ Rails also doesn't support automatic load balancing of replicas. This is very
563566
dependent on your infrastructure. We may implement basic, primitive load balancing
564567
in the future, but for an application at scale this should be something your application
565568
handles outside of Rails.
566-
567-
### Schema Cache
568-
569-
If you use a schema cache and multiple databases, you'll need to write an initializer
570-
that loads the schema cache from your app. This wasn't an issue we could resolve in
571-
time for Rails 6.0 but hope to have it in a future version soon.

0 commit comments

Comments
 (0)