spawn migration build
Usage
spawn migration build <migration> [--pinned] [--variables <path>] [--reveal-secrets] Renders a migration’s up.sql template into final SQL, resolving component includes and template variables. Outputs to stdout.
Arguments
Section titled “Arguments”<migration>— The migration directory name
Behavior
Section titled “Behavior”- Loads the migration’s
up.sqltemplate - Resolves component includes from
components/(orpinned/if--pinned) - Injects template variables from config or
--variablesfile - Renders final SQL to stdout
Without --pinned, the migration uses the current working tree versions of components. With --pinned, it uses the locked versions from the migration’s lock.toml.
Secrets
Section titled “Secrets”Any secret() calls in the template are masked by default (e.g. ***MASKED:name***); pass --reveal-secrets to render real values for local debugging. migration apply always reveals real values, since it actually runs the SQL. See the Secrets guide for full details, including why a masked build still verifies each secret is reachable.
Examples
Section titled “Examples”Build with current components:
spawn migration build 20260131120000-add-users-tableBuild with pinned components:
spawn migration build 20260131120000-add-users-table --pinnedBuild with custom variables:
spawn migration build 20260131120000-add-users-table --variables ./prod-vars.jsonBuild and show real secret values for debugging:
spawn migration build 20260131120000-add-users-table --reveal-secretsOptions
| Option | Description |
|---|---|
--pinned | Use pinned component versions from lock.toml |
--variables <path> | Path to variables file (JSON, TOML, or YAML). Values are available in templates under {{ variables }}. |
--reveal-secrets | Render real secret() values instead of masked placeholders. For local debugging only — build output is not executed. |
-e, --environment <name> | Override the environment for the target config. |
--target <name> | Select which target from spawn.toml to use. |
--config-file <path> | Path to config file. Defaults to spawn.toml. |
-d, --debug | Turn on debug output. |