You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/source/active_record_multiple_databases.md
+4-7Lines changed: 4 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,6 @@ The following features are not (yet) supported:
33
33
34
34
* Automatic swapping for horizontal sharding
35
35
* Load balancing replicas
36
-
* Dumping schema caches for multiple databases
37
36
38
37
## Setting up your application
39
38
@@ -549,6 +548,10 @@ order from one table cannot be applied to another table.
549
548
Rails can't guess this for you because association loading is lazy, to load `treats` in `@dog.treats`
550
549
Rails already needs to know what SQL should be generated.
551
550
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
+
552
555
## Caveats
553
556
554
557
### Automatic swapping for horizontal sharding
@@ -563,9 +566,3 @@ Rails also doesn't support automatic load balancing of replicas. This is very
563
566
dependent on your infrastructure. We may implement basic, primitive load balancing
564
567
in the future, but for an application at scale this should be something your application
565
568
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