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 |
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 |
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,1false,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.
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.
[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,rolesProject 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
--configfile. The package uses an absolute path as it is. - A relative
--migrationsormigrationsdirectory - A relative
--log-pathorlog-pathfile
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:
config.iniconfig.phpconfig.jsonconfig.yamlconfig.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:
app/migrations, if theappdirectory existsapps/migrations, if theappsdirectory existsmigrations
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.