Commands¶
Quick reference¶
| Command | Arguments | Options | Purpose |
|---|---|---|---|
init |
— | --force |
Generate default config |
init:mysql |
— | --force |
Generate MySQL defaults |
init:pgsql |
— | --force |
Generate PostgreSQL defaults |
init:sqlite |
— | --force |
Generate SQLite defaults |
make |
<name> |
--sql, --populate |
Create a migration |
migrate / up |
— | --dry-run, --pretend |
Run pending migrations |
rollback / down |
— | --dry-run, --pretend |
Roll back last batch |
reset |
— | --dry-run, --pretend |
Roll back all migrations |
refresh |
— | --dry-run, --pretend |
Roll back and rerun |
fresh |
— | — | Rebuild from a clean schema |
status |
— | — | Show migration status |
validate |
— | — | Validate migration files |
doctor |
— | — | Check environment/config |
repair |
— | --modified, --force |
Repair repository records |
squash |
[name] |
--force |
Create a schema baseline |
unsquash |
[archive] |
--force |
Restore pre-squash history |
help |
— | — | Show CLI help |
init¶
Driver-specific defaults:
Overwrite an existing generated config:
make¶
Argument¶
| Argument | Required | Description |
|---|---|---|
name |
Yes | Migration name used for template detection and filename |
Options¶
| Option | Description |
|---|---|
--sql |
Force a blank raw SQL migration |
--populate |
Create a PopulatorMigration (also selected automatically for names starting with populate_) |
Examples:
--sql and --populate cannot be used together.
migrate / up¶
Run pending migrations:
Alias:
Preview without executing:
or:
rollback / down¶
Roll back the latest batch:
Alias:
Preview:
reset¶
Roll back all managed migrations:
Preview:
refresh¶
Roll back all managed migrations and execute them again:
Preview:
fresh¶
Rebuild from a clean schema:
Use this when you intentionally want a clean database rebuilt from the active migrations.
status¶
Typical states include:
validate¶
Checks migration files and verifies that migration methods return supported statement types.
doctor¶
Checks common setup problems such as:
- config file
- configured bootstrap
- database connection
- PDO driver
- migrations path
- migration repository
repair¶
Remove migration records whose files are missing:
Accept current checksums of intentionally modified migrations:
Skip confirmation:
repair --modified updates the repository checksum. It does not rerun the migration.
squash¶
Custom baseline name:
Skip confirmation:
See Squash & Unsquash.
unsquash¶
Restore the latest squash history:
Select an archive:
Skip confirmation:
Unsquash restores migration history and files. It does not roll back the current database schema.
help¶
Progressive SQLite CLI workflow¶
The CLI integration test exercises the commands as one continuous workflow against the same temporary SQLite database. It initializes configuration, creates and adopts a baseline, generates and runs a population migration, checks status and validation, then exercises migration aliases, rollback, reset, refresh, fresh, repair, squash, and unsquash. Database state carries forward between commands; the test does not create a new database for each command.
Run it directly:
The regular composer test command also runs this workflow, including in the
GitHub Actions test job. The test uses an isolated temporary project and
removes it after completion, so it does not touch an application's database.