SYSTEM Cited by 1 source
planetscale_rails gem¶
What it is¶
planetscale_rails
is PlanetScale's Ruby gem that integrates Rails'
ActiveRecord migration workflow with PlanetScale's
schema-change lifecycle.
Named in Coutermarsh's 2024 post
How PlanetScale makes schema changes as the
migration executor used by PlanetScale's internal
CI pull-request bot: "We use the planetscale_rails
gem to run the migrations."
Role¶
The gem is the bridge between:
- Rails' ActiveRecord migration convention — files
under
db/migrate/*.rbwithup/downmethods. - PlanetScale's deploy-request lifecycle — every schema change runs via an isolated deploy request against a PlanetScale branch.
Without the gem, engineers would need to hand-translate
ActiveRecord::Migration DDL into pscale CLI calls.
The gem does this automatically, so the existing rake
db:migrate mental model continues to work against a
PlanetScale target.
Place in the architecture¶
┌─────────────────────────────────────────────┐
│ Rails app │
│ └── db/migrate/20240101_add_column.rb │
└─────────────────────────────────────────────┘
│ (file watched by PR-bot)
▼
┌─────────────────────────────────────────────┐
│ GitHub Actions PR-bot │
│ └── detects schema change → invokes… │
└─────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ planetscale_rails gem │
│ └── runs migration against PlanetScale │
│ branch via API │
└─────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ PlanetScale API / pscale CLI │
│ └── creates deploy request │
└─────────────────────────────────────────────┘
Seen in¶
- sources/2026-04-21-planetscale-how-planetscale-makes-schema-changes — canonical naming. Used inside PlanetScale's own Rails API CI workflow as the migration executor that the GitHub Actions PR-bot invokes. The post does not disclose the gem's internals; it names it as the tool-of-choice for the PR-bot auto-deploy-request pattern when the application framework is Rails.
Scope the source does not cover¶
- Gem internals: how it maps
ActiveRecord::MigrationDDL topscalecalls, which commands it supports, what version compatibility it has with Rails. - Whether it handles non-migration schema changes
(e.g. ad-hoc
ALTER TABLEoutsidedb/migrate/). - Its interaction with
rails db:schema:loadfor fresh-database initialisation. - Whether non-PlanetScale-customer Rails teams use it against plain MySQL as a safer migration executor.