@@ -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) ', |
@@ -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) ', |
@@ -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 | } |
@@ -75,5 +75,5 @@ |
||
| 75 | 75 | $this->getDbDriver()->execute('drop table migration_version'); |
| 76 | 76 | $this->createVersion(); |
| 77 | 77 | $this->setVersion($currentVersion, 'unknow'); |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | } |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function getVersion() |
| 35 | 35 | { |
| 36 | - $result = []; |
|
| 36 | + $result = [ ]; |
|
| 37 | 37 | try { |
| 38 | - $result['version'] = $this->getDbDriver()->getScalar('SELECT version FROM migration_version'); |
|
| 38 | + $result[ 'version' ] = $this->getDbDriver()->getScalar('SELECT version FROM migration_version'); |
|
| 39 | 39 | } catch (\Exception $ex) { |
| 40 | 40 | throw new DatabaseNotVersionedException('This database does not have a migration version. Please use "migrate reset" or "migrate install" to create one.'); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | try { |
| 44 | - $result['status'] = $this->getDbDriver()->getScalar('SELECT status FROM migration_version'); |
|
| 44 | + $result[ 'status' ] = $this->getDbDriver()->getScalar('SELECT status FROM migration_version'); |
|
| 45 | 45 | } catch (\Exception $ex) { |
| 46 | 46 | throw new OldVersionSchemaException('This database does not have a migration version. Please use "migrate install" for update it.'); |
| 47 | 47 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | // Get the version to check if exists |
| 66 | 66 | $versionInfo = $this->getVersion(); |
| 67 | - if (empty($versionInfo['version'])) { |
|
| 67 | + if (empty($versionInfo[ 'version' ])) { |
|
| 68 | 68 | $this->getDbDriver()->execute("insert into migration_version values(0, 'unknow')"); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | public function reset($upVersion = null) |
| 148 | 148 | { |
| 149 | 149 | if ($this->_callableProgress) { |
| 150 | - call_user_func_array($this->_callableProgress, ['reset', 0]); |
|
| 150 | + call_user_func_array($this->_callableProgress, [ 'reset', 0 ]); |
|
| 151 | 151 | } |
| 152 | 152 | $this->getDbCommand()->dropDatabase(); |
| 153 | 153 | $this->getDbCommand()->createDatabase(); |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | protected function migrate($upVersion, $increment, $force) |
| 210 | 210 | { |
| 211 | 211 | $versionInfo = $this->getCurrentVersion(); |
| 212 | - $currentVersion = intval($versionInfo['version']) + $increment; |
|
| 212 | + $currentVersion = intval($versionInfo[ 'version' ]) + $increment; |
|
| 213 | 213 | |
| 214 | - if (strpos($versionInfo['status'], 'partial') !== false && !$force) { |
|
| 214 | + if (strpos($versionInfo[ 'status' ], 'partial') !== false && !$force) { |
|
| 215 | 215 | throw new DatabaseIsIncompleteException('Database was not fully updated. Use --force for migrate.'); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | && file_exists($file = $this->getMigrationSql($currentVersion, $increment)) |
| 220 | 220 | ) { |
| 221 | 221 | if ($this->_callableProgress) { |
| 222 | - call_user_func_array($this->_callableProgress, ['migrate', $currentVersion]); |
|
| 222 | + call_user_func_array($this->_callableProgress, [ 'migrate', $currentVersion ]); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment>0 ? 'up' : 'down')); |
|
| 225 | + $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment > 0 ? 'up' : 'down')); |
|
| 226 | 226 | $this->getDbCommand()->executeSql(file_get_contents($file)); |
| 227 | 227 | $this->getDbCommand()->setVersion($currentVersion, 'complete'); |
| 228 | 228 | $currentVersion = $currentVersion + $increment; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | public function update($upVersion = null, $force = false) |
| 250 | 250 | { |
| 251 | 251 | $versionInfo = $this->getCurrentVersion(); |
| 252 | - $version = intval($versionInfo['version']); |
|
| 252 | + $version = intval($versionInfo[ 'version' ]); |
|
| 253 | 253 | $increment = 1; |
| 254 | 254 | if ($upVersion !== null && $upVersion < $version) { |
| 255 | 255 | $increment = -1; |