---
title: "CLI Arguments and Options"
description: "The arguments and the options of the command line."
version: "6.0"
---

> Documentation Index
> Fetch the complete documentation index at: https://migrations.phalcon.io/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Arguments and Options

**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](/6.0/other-actions#clean-the-database)                                     |
| `export`        | Show the SQL of the schema at a version. See [Export the schema](/6.0/other-actions#export-the-schema)                                     |
| `import-log`    | Copy the file log into the empty log table. See [Move the file log to the database](/6.0/log#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](/6.0/upgrade#upgrade-from-3x-to-40) |
| `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). Use it with `--ts-based`                                                                      |
| `--data=s`                    | Export data ['always' or 'oncreate'] (Data is imported during migration run). Other values stop `generate` with an error                                  |
| `--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](/6.0/migration-methods#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](/6.0/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](/6.0/configuration#application-options).

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

With `--skip-foreign-checks`, the package turns off the foreign key checks before the migration of each table. After the table, it sets the value of before again, also after an error. Thus the checks of the connection are the same before and after the run.

## Foreign key checks on PostgreSQL

On PostgreSQL, `--skip-foreign-checks` runs `SET session_replication_role = 'replica'` before the migration of each table. After the table, it sets the value of before again. The `SET` needs a superuser. On PostgreSQL 15 and later, a role that is not a superuser can get the privilege:

```sql
GRANT SET ON PARAMETER session_replication_role TO migrations_user;
```

Without the privilege, `run` stops before it changes the table, with the error `The option skip-foreign-checks on PostgreSQL needs a superuser, or on PostgreSQL 15 and later the SET privilege on session_replication_role`. The error also shows the PostgreSQL error.

Source: https://migrations.phalcon.io/6.0/cli/index.mdx
