| @@ 101-117 (lines=17) @@ | ||
| 98 | * |
|
| 99 | * @return string |
|
| 100 | */ |
|
| 101 | public function getMigrate($env = null, $target = null) |
|
| 102 | { |
|
| 103 | $command = ['migrate']; |
|
| 104 | if ($env ?: $this->hasOption('environment')) { |
|
| 105 | $command += ['-e' => $env ?: $this->getOption('environment')]; |
|
| 106 | } |
|
| 107 | if ($this->hasOption('configuration')) { |
|
| 108 | $command += ['-c' => $this->getOption('configuration')]; |
|
| 109 | } |
|
| 110 | if ($this->hasOption('parser')) { |
|
| 111 | $command += ['-p' => $this->getOption('parser')]; |
|
| 112 | } |
|
| 113 | if ($target) { |
|
| 114 | $command += ['-t' => $target]; |
|
| 115 | } |
|
| 116 | ||
| 117 | return $this->executeRun($command); |
|
| 118 | } |
|
| 119 | ||
| 120 | /** |
|
| @@ 160-178 (lines=19) @@ | ||
| 157 | * |
|
| 158 | * @return string |
|
| 159 | */ |
|
| 160 | public function getRollback($env = null, $target = null) |
|
| 161 | { |
|
| 162 | $command = ['rollback']; |
|
| 163 | if ($env ?: $this->hasOption('environment')) { |
|
| 164 | $command += ['-e' => $env ?: $this->getOption('environment')]; |
|
| 165 | } |
|
| 166 | if ($this->hasOption('configuration')) { |
|
| 167 | $command += ['-c' => $this->getOption('configuration')]; |
|
| 168 | } |
|
| 169 | if ($this->hasOption('parser')) { |
|
| 170 | $command += ['-p' => $this->getOption('parser')]; |
|
| 171 | } |
|
| 172 | if (isset($target)) { |
|
| 173 | // Need to use isset() with rollback, because -t0 is a valid option! |
|
| 174 | // See https://book.cakephp.org/phinx/0/en/commands.html#the-rollback-command |
|
| 175 | $command += ['-t' => $target]; |
|
| 176 | } |
|
| 177 | ||
| 178 | return $this->executeRun($command); |
|
| 179 | } |
|
| 180 | ||
| 181 | /** |
|