spawn migration pin
Usage
spawn migration pin <migration> Creates a snapshot of all components referenced by the migration and stores them in the content-addressable pinned/ directory. Writes a lock.toml file in the migration folder with the snapshot hash.
Arguments
Section titled “Arguments”<migration>— The migration directory name (e.g.,20260131120000-add-users-table)
Why pin?
Section titled “Why pin?”Pinning ensures migrations are reproducible:
- Historical migrations continue to work even as components evolve
- Tests can verify migrations against their original component versions
- Re-running old migrations produces identical SQL
Behavior
Section titled “Behavior”- Scans the migration’s
up.sqlfor component includes - Computes a content hash of all referenced components
- Stores snapshots in
pinned/<hash>/ - Creates
lock.tomlin the migration directory
Example
Section titled “Example”spawn migration pin 20260131120000-add-users-table# Migration pinned: a1b2c3d4e5f6g7h8The migration folder now contains:
migrations/20260131120000-add-users-table/├── up.sql└── lock.tomlOptions
| Option | Description |
|---|---|
-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. |