Skip to content

CLI Reference

When installed as a dependency, use Composer's binary path:

vendor/bin/schemage [options]

Inside the Schemage repository itself, bin/schemage may be used directly.

Option Description
--init Initialize project files
--dry-run Preview pending operations and SQL without executing
--yes Skip the confirmation prompt
--force Permit operations that may directly remove data
--status Show migration history
--rollback Roll back the latest migration batch
--fresh Drop all managed database tables
--clear-history Clear migration history when used by the relevant workflow
--generate-models Generate model classes
--sql Print SQL for pending schema changes
--schema-sql Print SQL for the complete desired schema
--verbose Show planned SQL during a normal migration
--trace Show stack traces when an error occurs
--help, -h Show CLI help

Common commands

vendor/bin/schemage
vendor/bin/schemage --dry-run
vendor/bin/schemage --yes
vendor/bin/schemage --force
vendor/bin/schemage --yes --force
vendor/bin/schemage --status
vendor/bin/schemage --rollback
vendor/bin/schemage --fresh --yes --force

Option semantics

--yes and --force have separate responsibilities:

  • --yes: do not ask for confirmation
  • --force: permit operations classified as potentially data-destructive

Therefore, fully non-interactive destructive execution requires both:

vendor/bin/schemage --yes --force