@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Test; |
| 3 | 3 | |
| 4 | -use ByJG\AnyDataset\Store\PdoMysql; |
|
| 5 | 4 | use ByJG\DbMigration\Migration; |
| 6 | 5 | use ByJG\Util\Uri; |
| 7 | 6 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | . "/" . ($increment < 0 ? "down" : "up") |
| 115 | 115 | . "/*.sql"; |
| 116 | 116 | |
| 117 | - $result = array_filter(glob($filePattern), function ($file) use ($version) { |
|
| 117 | + $result = array_filter(glob($filePattern), function($file) use ($version) { |
|
| 118 | 118 | return preg_match("/^0*$version(-dev)?\.sql$/", basename($file)); |
| 119 | 119 | }); |
| 120 | 120 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | public function reset($upVersion = null) |
| 150 | 150 | { |
| 151 | 151 | if ($this->callableProgress) { |
| 152 | - call_user_func_array($this->callableProgress, ['reset', 0]); |
|
| 152 | + call_user_func_array($this->callableProgress, [ 'reset', 0 ]); |
|
| 153 | 153 | } |
| 154 | 154 | $this->getDbCommand()->dropDatabase(); |
| 155 | 155 | $this->getDbCommand()->createDatabase(); |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | protected function migrate($upVersion, $increment, $force) |
| 212 | 212 | { |
| 213 | 213 | $versionInfo = $this->getCurrentVersion(); |
| 214 | - $currentVersion = intval($versionInfo['version']) + $increment; |
|
| 214 | + $currentVersion = intval($versionInfo[ 'version' ]) + $increment; |
|
| 215 | 215 | |
| 216 | - if (strpos($versionInfo['status'], 'partial') !== false && !$force) { |
|
| 216 | + if (strpos($versionInfo[ 'status' ], 'partial') !== false && !$force) { |
|
| 217 | 217 | throw new DatabaseIsIncompleteException('Database was not fully updated. Use --force for migrate.'); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -221,10 +221,10 @@ discard block |
||
| 221 | 221 | && file_exists($file = $this->getMigrationSql($currentVersion, $increment)) |
| 222 | 222 | ) { |
| 223 | 223 | if ($this->callableProgress) { |
| 224 | - call_user_func_array($this->callableProgress, ['migrate', $currentVersion]); |
|
| 224 | + call_user_func_array($this->callableProgress, [ 'migrate', $currentVersion ]); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment>0 ? 'up' : 'down')); |
|
| 227 | + $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment > 0 ? 'up' : 'down')); |
|
| 228 | 228 | $this->getDbCommand()->executeSql(file_get_contents($file)); |
| 229 | 229 | $this->getDbCommand()->setVersion($currentVersion, 'complete'); |
| 230 | 230 | $currentVersion = $currentVersion + $increment; |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | public function update($upVersion = null, $force = false) |
| 252 | 252 | { |
| 253 | 253 | $versionInfo = $this->getCurrentVersion(); |
| 254 | - $version = intval($versionInfo['version']); |
|
| 254 | + $version = intval($versionInfo[ 'version' ]); |
|
| 255 | 255 | $increment = 1; |
| 256 | 256 | if ($upVersion !== null && $upVersion < $version) { |
| 257 | 257 | $increment = -1; |