Senior Track Roadmap

Multi-database architecture

Rails 8 configures four databases by default: primary, cache, queue and cable. This course explains how that setup works in one application. Models and the Solid adapters name a role, and database.yml resolves it to a location. Each database has its own schema file and its own namespaced rake tasks. The course also covers how to decide which data gets its own database. It then shows the costs: connection pools that multiply, and no transactions or joins across databases. It ends with a connection-planning exercise.

What you'll learn

  • ✓How the primary, cache, queue and cable roles map to databases in database.yml
  • ✓Three ways to declare connects_to for Solid Queue, Solid Cache and Solid Cable
  • ✓What separate schema files and version: 1 tell you about each database
  • ✓How namespaced database tasks and db:prepare behave
  • ✓How to decide which data gets its own database
  • ✓How to count connections across pools and processes
Free preview · Lesson 1 3 min read

Four databases, one application

Rails 8 ships with four databases configured by default, and most developers never notice, because the framework hides the seam almost completely.

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...