---
title: "Configuration"
description: "The options of the configuration file, the project folder and the migrations folder."
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.

# Configuration

The configuration has two sections: `database` and `application`.

## Database options

| Key        | Description                                                                                                                                                               |
|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `adapter`  | Database adapter: `mysql`, `postgresql` or `sqlite`                                                                                                                       |
| `host`     | Database server host (MySQL and PostgreSQL)                                                                                                                               |
| `port`     | Database server port. Default: `3306` (MySQL), `5432` (PostgreSQL)                                                                                                        |
| `username` | Database user name                                                                                                                                                        |
| `password` | Database password                                                                                                                                                         |
| `dbname`   | Database name. For SQLite, the path to the database file                                                                                                                  |
| `schema`   | Schema that the package reads and changes. Default: the `dbname` value (MySQL), `public` (PostgreSQL). For PostgreSQL, the package also sets `search_path` to this schema |
| `charset`  | Character set of the connection (MySQL only). Default: `utf8mb4`                                                                                                          |

## Application options

| Key                       | Description                                                                                                                                                                            |
|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `migrations`              | Migrations directory. To use more than one directory, separate them with commas                                                                                                        |
| `log-in-db`               | `true` - keep the migrations log in the database. `false` - keep it in a file. See [Migrations log](/6.0/log)                                                                   |
| `log-path`                | Path of the log file. Default: `.phalcon/migration-version`. A relative path starts in the project directory. With the database log, `run` reads this file when the log table is empty |
| `log-table`               | Name of the log table (database log). Default: `phalcon_migrations`                                                                                                                    |
| `ts-based`                | `true` - `run`, `list`, `export` and `generate` use timestamp based versions. `false` (default) - incremental versions                                                                 |
| `descr`                   | Description for timestamp based versions. Use it with `ts-based`. See [Timestamp based migrations](/6.0/versions#timestamp-based-migrations)                                                        |
| `export-data-from-tables` | Tables to export data from. An array, or a comma-separated string. The data is exported with every migration                                                                           |
| `namespace`               | Namespace of the generated migration classes                                                                                                                                           |
| `truncate`                | `true` - same as the `--truncate` option                                                                                                                                               |
| `no-auto-increment`       | `true` - same as the `--no-auto-increment` option                                                                                                                                      |
| `skip-ref-schema`         | `true` - same as the `--skip-ref-schema` option                                                                                                                                        |
| `skip-foreign-checks`     | `true` - same as the `--skip-foreign-checks` option                                                                                                                                    |

Each key has the same name as its CLI option. When you set a key and its CLI option, the CLI option wins.

To turn off a boolean key of the configuration from the CLI, give the option the value `false`, for example `--log-in-db=false`. A boolean option accepts these values:

* `true`, `yes`, `y`, `on`, `1`
* `false`, `no`, `n`, `off`, `0`

Other values stop the command with an error. `--force=false` is the same as no `--force`.

In the configuration, a boolean key can have a text value, for example a quoted INI value (`truncate = "false"`) or a value from an environment variable. A text uses the same words, with no case: `false`, `no`, `n`, `off`, `0` and an empty text are `false`. Other texts are `true`.

:::warning[WARNING]
Four keys have new names. The old names work in version 5, but each old name gives a PHP deprecation notice. Version 6.0 removes the old names.

| New name                  | Old name               |
|---------------------------|------------------------|
| `migrations`              | `migrationsDir`        |
| `log-in-db`               | `logInDb`              |
| `ts-based`                | `migrationsTsBased`    |
| `export-data-from-tables` | `exportDataFromTables` |

The CLI option `--exportDataFromTables` is also an old name. Use `--export-data-from-tables`. The keys of the PHP API, for example `migrationsDir` in `Migrations::run()`, do not change.
:::

## Other configuration formats

The package also reads `.ini`, `.json`, `.yaml` and `.yml` files. These files use the same `database` and `application` sections. A YAML file needs the `yaml` PHP extension.

```ini
[database]
adapter  = mysql
host     = 127.0.0.1
username = root
password =
dbname   = db-name

[application]
log-in-db               = true
migrations              = db/migrations
ts-based                = true
export-data-from-tables = users,roles
```

## Project directory

The project directory is the value of the `--directory` option. The default is the current directory.

These paths are relative to the project directory:

* A relative `--config` file. The package uses an absolute path as it is.
* A relative `--migrations` or `migrations` directory
* A relative `--log-path` or `log-path` file

If the configuration file does not exist, the command stops with the error `Can't locate the configuration file.`

## Configuration file discovery

If you do not use `--config`, the package looks for a configuration file in the project directory. It looks in `app/config/` first, then in `config/`. In each directory, it looks for these files, in this order:

1. `config.ini`
2. `config.php`
3. `config.json`
4. `config.yaml`
5. `config.yml`

The package uses the first file that it finds. If it finds no file, the command stops with an error.

## Default migrations directory

If you do not set `--migrations` or `migrations`, the package uses the first of these directories that applies:

1. `app/migrations`, if the `app` directory exists
2. `apps/migrations`, if the `apps` directory exists
3. `migrations`

If you set more than one migrations directory, `generate` asks which directory to use. It creates only the directory that you select. A directory of the list that does not exist has no versions: `generate` finds the next version in the other directories.

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