spawn migration apply
Usage
spawn migration apply [migration] [options] Applies one or more migrations to the configured database. By default, requires migrations to be pinned for reproducibility.
Arguments
Section titled “Arguments”[migration]— Optional. Specific migration to apply. If omitted, applies all pending migrations.
Behavior
Section titled “Behavior”Single migration
Section titled “Single migration”spawn migration apply 20260131120000-add-users-tableApplies the specified migration if not already applied.
All pending migrations
Section titled “All pending migrations”spawn migration applyShows a list of pending migrations and prompts for confirmation before applying all.
Pin requirement
Section titled “Pin requirement”By default, apply requires migrations to have a lock.toml. This ensures the exact same component versions are used every time. Use --no-pin to bypass this requirement and use current working tree components (not recommended for production).
Retry logic
Section titled “Retry logic”If a migration previously failed, apply will refuse to run it again unless you pass --retry. This prevents accidental re-execution of partially applied migrations. Retrying a successful migration will run the same migration again.
Examples
Section titled “Examples”Apply all pending migrations:
spawn migration applyApply a specific migration without confirmation:
spawn migration apply 20260131120000-add-users-table --yesRetry a previously successful or failed migration:
spawn migration apply 20260131120000-add-users-table --retryUse unpinned components (not recommended):
spawn migration apply 20260131120000-add-users-table --no-pinOptions
| Option | Description |
|---|---|
--no-pin | Allow unpinned migrations (use current components) |
--variables <path> | Path to variables file (JSON, TOML, or YAML). Values are available in templates under {{ variables }}. |
--yes | Skip confirmation prompt |
--retry | Retry a previous migration |
-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. |