| @@ 113-129 (lines=17) @@ | ||
| 110 | * @param string $target target version (optional) |
|
| 111 | * @return string |
|
| 112 | */ |
|
| 113 | public function getMigrate($env = null, $target = null) |
|
| 114 | { |
|
| 115 | $command = ['migrate']; |
|
| 116 | if ($env ?: $this->hasOption('environment')) { |
|
| 117 | $command += ['-e' => $env ?: $this->getOption('environment')]; |
|
| 118 | } |
|
| 119 | if ($this->hasOption('configuration')) { |
|
| 120 | $command += ['-c' => $this->getOption('configuration')]; |
|
| 121 | } |
|
| 122 | if ($this->hasOption('parser')) { |
|
| 123 | $command += ['-p' => $this->getOption('parser')]; |
|
| 124 | } |
|
| 125 | if ($target) { |
|
| 126 | $command += ['-t' => $target]; |
|
| 127 | } |
|
| 128 | ||
| 129 | return $this->executeRun($command); |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| @@ 168-186 (lines=19) @@ | ||
| 165 | * @param mixed $target target version, or 0 (zero) fully revert (optional) |
|
| 166 | * @return string |
|
| 167 | */ |
|
| 168 | public function getRollback($env = null, $target = null) |
|
| 169 | { |
|
| 170 | $command = ['rollback']; |
|
| 171 | if ($env ?: $this->hasOption('environment')) { |
|
| 172 | $command += ['-e' => $env ?: $this->getOption('environment')]; |
|
| 173 | } |
|
| 174 | if ($this->hasOption('configuration')) { |
|
| 175 | $command += ['-c' => $this->getOption('configuration')]; |
|
| 176 | } |
|
| 177 | if ($this->hasOption('parser')) { |
|
| 178 | $command += ['-p' => $this->getOption('parser')]; |
|
| 179 | } |
|
| 180 | if (isset($target)) { |
|
| 181 | // Need to use isset() with rollback, because -t0 is a valid option! |
|
| 182 | // See http://docs.phinx.org/en/latest/commands.html#the-rollback-command |
|
| 183 | $command += ['-t' => $target]; |
|
| 184 | } |
|
| 185 | ||
| 186 | return $this->executeRun($command); |
|
| 187 | } |
|
| 188 | ||
| 189 | /** |
|