Two CLI commands drive FoxDB's database-evolution workflow:
migrate— apply, roll back, refresh, and inspect schema migrations fromdatabase/migrationsdb:seed— run seeders fromdatabase/seedersto populate the database
Both delegate to the underlying APIs documented in Database → Migrations, Schema & Seeders — Foxdb\Migrations\Migrator and Foxdb\Seeders\SeederRunner. This page focuses on the CLI surface.
php webrium migrate [<action>] [--step=<n>] [--connection=<name>] [--seed] [--force]| Action | Effect |
|---|---|
run (default) |
Apply all pending migrations |
rollback |
Roll back the last batch (or --step migrations across batches) |
reset |
Roll back every migration that has been run |
refresh |
Roll back everything, then re-run all migrations |
status |
Show which migrations have run, and in which batch |
run is the default, so php webrium migrate and php webrium migrate run are equivalent.
| Option | Description |
|---|---|
--step |
Limit run / rollback to a specific number of migrations |
--connection, -c |
Run against a named connection instead of the default |
--seed |
After a successful run or refresh, also run every seeder in database/seeders |
--force, -f |
Skip the confirmation prompt for reset / refresh |
# Apply all pending migrations
php webrium migrate
php webrium migrate run
# Show migration status
php webrium migrate status
# Roll back the most recent batch
php webrium migrate rollback
# Roll back only the last 2 individual migrations
php webrium migrate rollback --step=2
# Roll back everything, with confirmation
php webrium migrate reset
# Roll back everything without confirmation
php webrium migrate reset --force
# Reset and re-run all migrations
php webrium migrate refresh --force
# Run against a non-default connection
php webrium migrate --connection=secondary
# Apply pending migrations, then run all seeders
php webrium migrate --seed
# Reset, re-run, and re-seed in one command
php webrium migrate refresh --seed --force- Batches. Every migration applied in the same
runcall is grouped under a single batch number in themigrationstable.rollbackwith no--stepreverses the entire most recent batch.rollback --step=Nreverses the lastNindividual migrations regardless of batch boundaries. - Transactions. Each migration runs inside its own database transaction. If a migration fails, the transaction is rolled back and
migratestops — earlier migrations in the same run stay applied. - Production safety.
resetandrefreshask for confirmation before running. Pass--forceto bypass the prompt in scripts. --seed. When passed alongsiderunorrefresh, every seeder indatabase/seedersruns after the schema is in place. The seed step uses the same connection as the migrate step.
Prints a table of every migration file in database/migrations and whether it's been applied:
+------------------------------------------+-----+-------+
| Migration | Ran | Batch |
+------------------------------------------+-----+-------+
| 2024_01_15_120000_create_users_table | Yes | 1 |
| 2024_01_16_093000_add_score_to_users | Yes | 1 |
| 2024_02_01_140000_create_posts_table | No | - |
+------------------------------------------+-----+-------+
Useful for sanity-checking before a deploy or before rolling back. status is read-only — it never modifies the schema.
php webrium db:seed [<class>] [--connection=<name>] [--no-transaction] [--force]Runs seeders from database/seeders. Seeders are not tracked between runs — calling db:seed repeatedly re-runs them. Write seeders to be idempotent (e.g. updateOrInsert(), where(...)->exists() guards) when this matters.
| Argument | Description |
|---|---|
class |
Optional. Class or file name of a single seeder to run. If omitted, every seeder in database/seeders runs in alphabetical order |
| Option | Description |
|---|---|
--connection, -c |
Run against a named connection instead of the default |
--no-transaction |
Don't wrap each seeder in a transaction |
--force, -f |
Skip the confirmation prompt when APP_ENV=production |
# Run every seeder in database/seeders
php webrium db:seed
# Run a single seeder by file name
php webrium db:seed UsersSeeder
# Run a single seeder by fully qualified class name
php webrium db:seed "App\\Seeders\\UsersSeeder"
# Use a non-default connection
php webrium db:seed --connection=secondary
# Disable per-seeder transactions (e.g. for DDL inside the seeder)
php webrium db:seed --no-transaction
# Run in production without an interactive prompt
APP_ENV=production php webrium db:seed --force- Transactions. Each seeder runs inside its own transaction by default, so a failure mid-seeder rolls back any inserts that seeder made. Pass
--no-transactionfor engines or operations that don't play well with transactional writes. - Order. When run without a class argument, seeders execute in alphabetical order of file name. To control the order, either prefix file names (
01_users.php,02_roles.php) or use a single top-levelDatabaseSeederthat calls the others via$this->call(...). - Failure handling. If a seeder fails,
db:seedstops and reports it — seeders that already completed remain applied. - Production confirmation. When
APP_ENVisproduction(orprod),db:seedasks for confirmation before running.--forcebypasses the prompt — required for non-interactive deploys.
A common deploy or local-reset sequence:
# First time on a new machine
php webrium migrate --seed
# After pulling new migrations
php webrium migrate
# When something's wrong and you want a fresh start (dev only)
php webrium migrate refresh --seed --forceFor continuous integration:
# A green-field DB for tests
php webrium migrate run --connection=testing
php webrium db:seed --connection=testing --forceFor details on writing migrations and seeders themselves, see Database → Migrations, Schema & Seeders.