@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getVersion() |
50 | 50 | { |
51 | - $result = []; |
|
51 | + $result = [ ]; |
|
52 | 52 | try { |
53 | - $result['version'] = $this->getDbDriver()->getScalar('SELECT version FROM migration_version'); |
|
53 | + $result[ 'version' ] = $this->getDbDriver()->getScalar('SELECT version FROM migration_version'); |
|
54 | 54 | } catch (\Exception $ex) { |
55 | 55 | throw new DatabaseNotVersionedException('This database does not have a migration version. Please use "migrate reset" or "migrate install" to create one.'); |
56 | 56 | } |
57 | 57 | |
58 | 58 | try { |
59 | - $result['status'] = $this->getDbDriver()->getScalar('SELECT status FROM migration_version'); |
|
59 | + $result[ 'status' ] = $this->getDbDriver()->getScalar('SELECT status FROM migration_version'); |
|
60 | 60 | } catch (\Exception $ex) { |
61 | 61 | throw new OldVersionSchemaException('This database does not have a migration version. Please use "migrate install" for update it.'); |
62 | 62 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | { |
88 | 88 | // Get the version to check if exists |
89 | 89 | $versionInfo = $this->getVersion(); |
90 | - if (empty($versionInfo['version'])) { |
|
90 | + if (empty($versionInfo[ 'version' ])) { |
|
91 | 91 | $this->getDbDriver()->execute("insert into migration_version values(0, 'unknow')"); |
92 | 92 | } |
93 | 93 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @var array |
41 | 41 | */ |
42 | - protected $databases = []; |
|
42 | + protected $databases = [ ]; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Migration constructor. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function registerDatabase($scheme, $className) |
67 | 67 | { |
68 | - $this->databases[$scheme] = $className; |
|
68 | + $this->databases[ $scheme ] = $className; |
|
69 | 69 | return $this; |
70 | 70 | } |
71 | 71 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function getDatabaseClassName() |
99 | 99 | { |
100 | - if (isset($this->databases[$this->uri->getScheme()])) { |
|
101 | - return $this->databases[$this->uri->getScheme()]; |
|
100 | + if (isset($this->databases[ $this->uri->getScheme() ])) { |
|
101 | + return $this->databases[ $this->uri->getScheme() ]; |
|
102 | 102 | } |
103 | 103 | throw new DatabaseDoesNotRegistered( |
104 | 104 | 'Scheme "' . $this->uri->getScheme() . '" does not found. Did you registered it?' |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | . "/" . ($increment < 0 ? "down" : "up") |
139 | 139 | . "/*.sql"; |
140 | 140 | |
141 | - $result = array_filter(glob($filePattern), function ($file) use ($version) { |
|
141 | + $result = array_filter(glob($filePattern), function($file) use ($version) { |
|
142 | 142 | return preg_match("/^0*$version(-dev)?\.sql$/", basename($file)); |
143 | 143 | }); |
144 | 144 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | public function reset($upVersion = null) |
181 | 181 | { |
182 | 182 | if ($this->callableProgress) { |
183 | - call_user_func_array($this->callableProgress, ['reset', 0]); |
|
183 | + call_user_func_array($this->callableProgress, [ 'reset', 0 ]); |
|
184 | 184 | } |
185 | 185 | $this->getDbCommand()->dropDatabase(); |
186 | 186 | $this->getDbCommand()->createDatabase(); |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | protected function migrate($upVersion, $increment, $force) |
256 | 256 | { |
257 | 257 | $versionInfo = $this->getCurrentVersion(); |
258 | - $currentVersion = intval($versionInfo['version']) + $increment; |
|
258 | + $currentVersion = intval($versionInfo[ 'version' ]) + $increment; |
|
259 | 259 | |
260 | - if (strpos($versionInfo['status'], 'partial') !== false && !$force) { |
|
260 | + if (strpos($versionInfo[ 'status' ], 'partial') !== false && !$force) { |
|
261 | 261 | throw new DatabaseIsIncompleteException('Database was not fully updated. Use --force for migrate.'); |
262 | 262 | } |
263 | 263 | |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | && file_exists($file = $this->getMigrationSql($currentVersion, $increment)) |
266 | 266 | ) { |
267 | 267 | if ($this->callableProgress) { |
268 | - call_user_func_array($this->callableProgress, ['migrate', $currentVersion]); |
|
268 | + call_user_func_array($this->callableProgress, [ 'migrate', $currentVersion ]); |
|
269 | 269 | } |
270 | 270 | |
271 | - $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment>0 ? 'up' : 'down')); |
|
271 | + $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment > 0 ? 'up' : 'down')); |
|
272 | 272 | $this->getDbCommand()->executeSql(file_get_contents($file)); |
273 | 273 | $this->getDbCommand()->setVersion($currentVersion, 'complete'); |
274 | 274 | $currentVersion = $currentVersion + $increment; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | public function update($upVersion = null, $force = false) |
306 | 306 | { |
307 | 307 | $versionInfo = $this->getCurrentVersion(); |
308 | - $version = intval($versionInfo['version']); |
|
308 | + $version = intval($versionInfo[ 'version' ]); |
|
309 | 309 | $increment = 1; |
310 | 310 | if ($upVersion !== null && $upVersion < $version) { |
311 | 311 | $increment = -1; |