config/database.yml

    I‘ve mentioned previously that Joy of Rails uses SQLite along with Rails support for multiple databases. Here's a snapshot of what the Joy of Rails config/database.yml file looks like in development. I’ve separated the database for each of the Rails "backends" running on SQLite, including ActiveRecord (primary), Rails cache, Solid Queue job queue, and Action Cable. Each simply maps to a different file on disk.

    config/database.yml
    default: &default
      adapter: sqlite3
      pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 3 } %>
      timeout: 5000
    
    development:
      primary:
        <<: *default
        database: storage/development/data.sqlite3
      cache:
        <<: *default
        database: storage/development/cache.sqlite3
        migrations_paths: db/migrate_cache
      queue:
        <<: *default
        database: storage/development/queue.sqlite3
        migrations_paths: db/migrate_queue
      cable:
        <<: *default
        database: storage/development/cable.sqlite3
        migrations_paths: db/migrate_cable
    Published: · Updated:

    Back to snippets