mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 01:02:24 +01:00
118 lines
2.5 KiB
Markdown
118 lines
2.5 KiB
Markdown
<!-- DO NOT EDIT THIS FILE! -->
|
|
<!-- Instead edit contrib/phinx.php -->
|
|
<!-- Then run bin/docgen -->
|
|
|
|
# phinx
|
|
|
|
[Source](/contrib/phinx.php)
|
|
|
|
|
|
|
|
## Installing
|
|
|
|
Add to your _deploy.php_
|
|
|
|
```php
|
|
require 'contrib/phinx.php';
|
|
```
|
|
|
|
## Configuration options
|
|
|
|
All options are in the config parameter `phinx` specified as an array (instead of the `phinx_path` variable).
|
|
All parameters are *optional*, but you can specify them with a dictionary (to change all parameters)
|
|
or by deployer dot notation (to change one option).
|
|
|
|
### Phinx params
|
|
|
|
- `phinx.environment`
|
|
- `phinx.date`
|
|
- `phinx.configuration` N.B. current directory is the project directory
|
|
- `phinx.target`
|
|
- `phinx.seed`
|
|
- `phinx.parser`
|
|
- `phinx.remove-all` (pass empty string as value)
|
|
|
|
### Phinx path params
|
|
|
|
- `phinx_path` Specify phinx path (by default phinx is searched for in $PATH, ./vendor/bin and ~/.composer/vendor/bin)
|
|
|
|
### Example of usage
|
|
|
|
```php
|
|
$phinx_env_vars = [
|
|
'environment' => 'development',
|
|
'configuration' => './migration/.phinx.yml',
|
|
'target' => '20120103083322',
|
|
'remove-all' => '',
|
|
];
|
|
|
|
set('phinx_path', '/usr/local/phinx/bin/phinx');
|
|
set('phinx', $phinx_env_vars);
|
|
|
|
after('cleanup', 'phinx:migrate');
|
|
|
|
or set it for a specific server
|
|
host('dev')
|
|
->user('user')
|
|
->set('deploy_path', '/var/www')
|
|
->set('phinx', $phinx_env_vars)
|
|
->set('phinx_path', '');
|
|
```
|
|
|
|
## Suggested Usage
|
|
|
|
You can run all tasks before or after any
|
|
tasks (but you need to specify external configs for phinx).
|
|
If you use internal configs (which are in your project) you need
|
|
to run it after the `deploy:update_code` task is completed.
|
|
|
|
## Read more
|
|
|
|
For further reading see [phinx.org](https://phinx.org). Complete descriptions of all possible options can be found on the [commands page](http://docs.phinx.org/en/latest/commands.html).
|
|
|
|
|
|
|
|
## Configuration
|
|
### bin/phinx
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/phinx.php#L87)
|
|
|
|
Path to Phinx
|
|
|
|
|
|
|
|
|
|
## Tasks
|
|
|
|
### phinx:migrate
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/phinx.php#L154)
|
|
|
|
Migrating database with phinx.
|
|
|
|
|
|
|
|
|
|
### phinx:rollback
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/phinx.php#L176)
|
|
|
|
Rollback database migrations with phinx.
|
|
|
|
|
|
|
|
|
|
### phinx:seed
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/phinx.php#L198)
|
|
|
|
Seed database with phinx.
|
|
|
|
|
|
|
|
|
|
### phinx:breakpoint
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/phinx.php#L219)
|
|
|
|
Set a migrations breakpoint with phinx.
|
|
|
|
|
|
|
|
|