CLI Commands
All available commands for vendor/bin/rowcast-schema.
Table of contents
Overview
By default, the CLI reads configuration from rowcast-schema.php in the current working directory.
vendor/bin/rowcast-schema <command> [options]
Global options
| Option | Description |
|---|---|
--config=path / --config path |
Use a custom config file path |
diff
Compare the schema file against the live database and generate a migration.
vendor/bin/rowcast-schema diff
Options
| Option | Description |
|---|---|
--dry-run |
Print operations to stdout without generating a migration file |
How it works
- Parses the configured schema file → builds the desired
Schemamodel. - Introspects the live database via PDO → builds the current
Schemamodel. SchemaDiffercomputes a list of operations (create, drop, add, alter, etc.).MigrationGeneratorcreates a PHP migration class in the configured migrations directory.
migrate
Apply all pending migrations in timestamp order.
vendor/bin/rowcast-schema migrate
How it works
MigrationLoaderscans the migrations directory and sorts files by timestamp prefix.MigrationRunnerchecks which migrations have already been applied (stored in_rowcast_migrationstable).- Each pending migration’s
up()method is executed. - For PostgreSQL, each migration is wrapped in a transaction (DDL-safe). MySQL does not support transactional DDL.
rollback
Roll back the latest migration, or multiple.
# Roll back the last migration
vendor/bin/rowcast-schema rollback
# Roll back the last 3 migrations
vendor/bin/rowcast-schema rollback --step=3
Options
| Option | Description |
|---|---|
--step=N |
Number of migrations to roll back (default: 1) |
status
Show migration state and schema synchronization status.
vendor/bin/rowcast-schema status
Output includes
- List of applied migrations with timestamps
- List of pending (not yet applied) migrations
- Live diff between the schema file and the current database
- Summary: “Schema is in sync” or a list of differences