← Graph

Branch-Specific SQLite Databases

concept 1 connections

Developer-experience pattern enabled by SQLite's file-as-database nature. database.yml runs through ERB, which can shell out to `git rev-parse` to derive the current branch name and include it in the database filename. A two-line `after_initialize` hook runs `ActiveRecord::Tasks::DatabaseTasks.prepare` on boot so switching branches (server, console, `rails runner`) automatically migrates and seeds an isolated database — no need to reconcile incompatible migrations between your branch and a colleague's.

category
practice
about
Branch-Specific SQLite Databases concept
Developer-experience tip demonstrated near the end of the talk.

Provenance

Read by
9 extractions