Skip to content

CLI Arguments and Options

The arguments and the options of the command line.

Arguments

Argument Description
generate Generate a Migration
run Run a Migration
list List all available migrations
clean Drop the tables, or delete their data. See Clean the database
export Show the SQL of the schema at a version. See Export the schema
import-log Copy the file log into the empty log table. See Move the file log to the database
migrate-files Update migration files to use the Phalcon\Migrations\Db classes. See Upgrade from 3.x to 4.0
help Shows the help

Options

Action Description
--config=s Configuration file. A relative path starts in the project directory
--migrations=s Migrations directory. Use comma separated string to specify multiple directories
--directory=s Directory where the project was created
--table=s Table to migrate. Table name, comma-separated table names, or table prefix with an asterisk. Default: all. clean and export accept only table names
--version=s Version to generate, version to migrate to, or version to export
--descr=s Migration description (used for timestamp-based migration)
--data=s Export data [‘always’ or ‘oncreate’] (Data is imported during migration run)
--export-data-from-tables=s Export data from specific tables, use comma-separated string
--truncate Empty each table before its data is imported (Running only). See Export data
--force Forces to overwrite existing migrations, or confirms the clean action
--data-only Delete the data and keep the tables (clean only)
--ts-based Timestamp based migration version
--log-in-db Keep migrations log in the database table rather than in file. See Migrations log
--log-path=s Path of the log file. With the database log, run reads it when the log table is empty. Default: .phalcon/migration-version
--log-table=s Name of the log table (database log only). Default: phalcon_migrations
--namespace=s Namespace of the generated migration classes (Generating only)
--dry Attempt requested operation without making changes to system (Generating only). run --dry stops with the error The --dry option is for generate only.
--dry-run Show the files to change, but do not change them (migrate-files only)
--verbose Output of debugging information during operation (Running only)
--no-auto-increment Leave out the AUTO_INCREMENT value of the table (Generating only)
--skip-ref-schema Leave out the schema of the referenced table in the foreign keys (Generating only)
--skip-foreign-checks Disable the foreign key checks during the run. MySQL: SET FOREIGN_KEY_CHECKS. PostgreSQL: SET session_replication_role (Running only)
--help Shows this help

A boolean option takes =false to turn off a value of the configuration, for example --log-in-db=false. See Application options.

The command writes the banner Phalcon Migrations and the error messages to stderr. The output of the action goes to stdout.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close