@@ -27,8 +27,8 @@ |
||
| 27 | 27 | parent::execute($input, $output); |
| 28 | 28 | try { |
| 29 | 29 | $versionInfo = $this->migration->getCurrentVersion(); |
| 30 | - $output->writeln('version: ' . $versionInfo['version']); |
|
| 31 | - $output->writeln('status.: ' . $versionInfo['status']); |
|
| 30 | + $output->writeln('version: ' . $versionInfo[ 'version' ]); |
|
| 31 | + $output->writeln('status.: ' . $versionInfo[ 'status' ]); |
|
| 32 | 32 | } catch (\Exception $ex) { |
| 33 | 33 | $this->handleError($ex, $output); |
| 34 | 34 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | { |
| 28 | 28 | try { |
| 29 | 29 | $versionInfo = $this->migration->getCurrentVersion(); |
| 30 | - if (strpos($versionInfo['status'], 'partial') !== false) { |
|
| 30 | + if (strpos($versionInfo[ 'status' ], 'partial') !== false) { |
|
| 31 | 31 | $helper = $this->getHelper('question'); |
| 32 | 32 | $question = new ConfirmationQuestion( |
| 33 | 33 | 'The database was not fully updated and maybe be unstable. Did you really want migrate the version? (y/N)', |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | { |
| 30 | 30 | try { |
| 31 | 31 | $versionInfo = $this->migration->getCurrentVersion(); |
| 32 | - if (strpos($versionInfo['status'], 'partial') !== false) { |
|
| 32 | + if (strpos($versionInfo[ 'status' ], 'partial') !== false) { |
|
| 33 | 33 | $helper = $this->getHelper('question'); |
| 34 | 34 | $question = new ConfirmationQuestion( |
| 35 | 35 | 'The database was not fully updated and maybe be unstable. Did you really want migrate the version? (y/N) ', |
@@ -42,8 +42,8 @@ |
||
| 42 | 42 | |
| 43 | 43 | $version = $this->migration->getCurrentVersion(); |
| 44 | 44 | $output->writeln($action); |
| 45 | - $output->writeln('current version: ' . $version['version']); |
|
| 46 | - $output->writeln('current status.: ' . $version['status']); |
|
| 45 | + $output->writeln('current version: ' . $version[ 'version' ]); |
|
| 46 | + $output->writeln('current status.: ' . $version[ 'status' ]); |
|
| 47 | 47 | } catch (\Exception $ex) { |
| 48 | 48 | $this->handleError($ex, $output); |
| 49 | 49 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $currentDbName = $dbDriver->getScalar( |
| 27 | 27 | "SELECT datname FROM pg_catalog.pg_database WHERE lower(datname) = lower(:dbname)", |
| 28 | - ['dbname' => $database] |
|
| 28 | + [ 'dbname' => $database ] |
|
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | if (empty($currentDbName)) { |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | public function getExpectedUsersVersion1() |
| 15 | 15 | { |
| 16 | 16 | return [ |
| 17 | - ["id" => 1, "name" => 'John Doe', 'createdate' => 'Jan 10 2016 12:00:00:AM'], |
|
| 18 | - ["id" => 2, "name" => 'Jane Doe', 'createdate' => 'Dec 30 2015 12:00:00:AM'] |
|
| 17 | + [ "id" => 1, "name" => 'John Doe', 'createdate' => 'Jan 10 2016 12:00:00:AM' ], |
|
| 18 | + [ "id" => 2, "name" => 'Jane Doe', 'createdate' => 'Dec 30 2015 12:00:00:AM' ] |
|
| 19 | 19 | ]; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | { |
| 30 | 30 | try { |
| 31 | 31 | $versionInfo = $this->migration->getCurrentVersion(); |
| 32 | - if (strpos($versionInfo['status'], 'partial') !== false) { |
|
| 32 | + if (strpos($versionInfo[ 'status' ], 'partial') !== false) { |
|
| 33 | 33 | $helper = $this->getHelper('question'); |
| 34 | 34 | $question = new ConfirmationQuestion( |
| 35 | 35 | 'The database was not fully updated and maybe be unstable. Did you really want migrate the version? (y/N) ', |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) { |
| 87 | - $this->migration->addCallbackProgress(function ($command, $version) use ($output) { |
|
| 87 | + $this->migration->addCallbackProgress(function($command, $version) use ($output) { |
|
| 88 | 88 | $output->writeln('Doing: ' . $command . " to " . $version); |
| 89 | 89 | }); |
| 90 | 90 | } |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | - * @param \Exception|\Error $exception |
|
| 118 | + * @param \Exception $exception |
|
| 119 | 119 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
| 120 | 120 | */ |
| 121 | 121 | protected function handleError($exception, OutputInterface $output) |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * @var array |
| 41 | 41 | */ |
| 42 | - protected $databases = []; |
|
| 42 | + protected $databases = [ ]; |
|
| 43 | 43 | /** |
| 44 | 44 | * @var string |
| 45 | 45 | */ |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function registerDatabase($scheme, $className) |
| 73 | 73 | { |
| 74 | - $this->databases[$scheme] = $className; |
|
| 74 | + $this->databases[ $scheme ] = $className; |
|
| 75 | 75 | return $this; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function getDatabaseClassName() |
| 105 | 105 | { |
| 106 | - if (isset($this->databases[$this->uri->getScheme()])) { |
|
| 107 | - return $this->databases[$this->uri->getScheme()]; |
|
| 106 | + if (isset($this->databases[ $this->uri->getScheme() ])) { |
|
| 107 | + return $this->databases[ $this->uri->getScheme() ]; |
|
| 108 | 108 | } |
| 109 | 109 | throw new DatabaseDoesNotRegistered( |
| 110 | 110 | 'Scheme "' . $this->uri->getScheme() . '" does not found. Did you registered it?' |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | . "/" . ($increment < 0 ? "down" : "up") |
| 145 | 145 | . "/*.sql"; |
| 146 | 146 | |
| 147 | - $result = array_filter(glob($filePattern), function ($file) use ($version) { |
|
| 147 | + $result = array_filter(glob($filePattern), function($file) use ($version) { |
|
| 148 | 148 | return preg_match("/^0*$version(-dev)?\.sql$/", basename($file)); |
| 149 | 149 | }); |
| 150 | 150 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | public function reset($upVersion = null) |
| 187 | 187 | { |
| 188 | 188 | if ($this->callableProgress) { |
| 189 | - call_user_func_array($this->callableProgress, ['reset', 0]); |
|
| 189 | + call_user_func_array($this->callableProgress, [ 'reset', 0 ]); |
|
| 190 | 190 | } |
| 191 | 191 | $this->getDbCommand()->dropDatabase(); |
| 192 | 192 | $this->getDbCommand()->createDatabase(); |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | protected function migrate($upVersion, $increment, $force) |
| 266 | 266 | { |
| 267 | 267 | $versionInfo = $this->getCurrentVersion(); |
| 268 | - $currentVersion = intval($versionInfo['version']) + $increment; |
|
| 268 | + $currentVersion = intval($versionInfo[ 'version' ]) + $increment; |
|
| 269 | 269 | |
| 270 | - if (strpos($versionInfo['status'], 'partial') !== false && !$force) { |
|
| 270 | + if (strpos($versionInfo[ 'status' ], 'partial') !== false && !$force) { |
|
| 271 | 271 | throw new DatabaseIsIncompleteException('Database was not fully updated. Use --force for migrate.'); |
| 272 | 272 | } |
| 273 | 273 | |
@@ -275,10 +275,10 @@ discard block |
||
| 275 | 275 | && file_exists($file = $this->getMigrationSql($currentVersion, $increment)) |
| 276 | 276 | ) { |
| 277 | 277 | if ($this->callableProgress) { |
| 278 | - call_user_func_array($this->callableProgress, ['migrate', $currentVersion]); |
|
| 278 | + call_user_func_array($this->callableProgress, [ 'migrate', $currentVersion ]); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment>0 ? 'up' : 'down')); |
|
| 281 | + $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment > 0 ? 'up' : 'down')); |
|
| 282 | 282 | $this->getDbCommand()->executeSql(file_get_contents($file)); |
| 283 | 283 | $this->getDbCommand()->setVersion($currentVersion, 'complete'); |
| 284 | 284 | $currentVersion = $currentVersion + $increment; |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | public function update($upVersion = null, $force = false) |
| 316 | 316 | { |
| 317 | 317 | $versionInfo = $this->getCurrentVersion(); |
| 318 | - $version = intval($versionInfo['version']); |
|
| 318 | + $version = intval($versionInfo[ 'version' ]); |
|
| 319 | 319 | $increment = 1; |
| 320 | 320 | if ($upVersion !== null && $upVersion < $version) { |
| 321 | 321 | $increment = -1; |