Master Guides

Database

A friendly wrapper over MasterRecord migrations.

master db runs the MasterRecord migration CLI inside your backend/ workspace with the right context and environment — so you never juggle paths.

The everyday loop#

terminal
$ # change a model, then:
$ master db new AddPosts # generate a migration from the diff
$ master db migrate # apply pending migrations

All actions#

CommandWhat it does
master db migrateApply pending migrations (update-database).
master db new <Name>Create a migration from current models (add-migration).
master db rollbackRevert the latest migration (update-database-down).
master db enableOne-time: create the snapshot (enable-migrations).
master db listList migration files (get-migrations).
master db ensureCreate the database if missing (ensure-database, MySQL).

Choosing the environment#

terminal
$ master db migrate --env production
$ # or
$ NODE_ENV=production master db migrate
Note
The context is AppContext (in backend/app/models/AppContext.js). Database credentials live in backend/config/environments/env.<env>.json, keyed by AppContext.