@@ -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 | } |
@@ -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)) { |
@@ -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; |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | protected function getExpectedUsersVersion0() |
68 | 68 | { |
69 | 69 | return [ |
70 | - ["id" => 1, "name" => 'John Doe', 'createdate' => '20160110'], |
|
71 | - ["id" => 2, "name" => 'Jane Doe', 'createdate' => '20151230'] |
|
70 | + [ "id" => 1, "name" => 'John Doe', 'createdate' => '20160110' ], |
|
71 | + [ "id" => 2, "name" => 'Jane Doe', 'createdate' => '20151230' ] |
|
72 | 72 | ]; |
73 | 73 | } |
74 | 74 | |
75 | 75 | protected function getExpectedUsersVersion1() |
76 | 76 | { |
77 | 77 | return [ |
78 | - ["id" => 1, "name" => 'John Doe', 'createdate' => '2016-01-10'], |
|
79 | - ["id" => 2, "name" => 'Jane Doe', 'createdate' => '2015-12-30'] |
|
78 | + [ "id" => 1, "name" => 'John Doe', 'createdate' => '2016-01-10' ], |
|
79 | + [ "id" => 2, "name" => 'Jane Doe', 'createdate' => '2015-12-30' ] |
|
80 | 80 | ]; |
81 | 81 | } |
82 | 82 | |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | $this->assertTrue($iterator->hasNext()); |
91 | 91 | $row = $iterator->moveNext(); |
92 | 92 | $this->assertEquals( |
93 | - $this->getExpectedUsersVersion0()[0], |
|
93 | + $this->getExpectedUsersVersion0()[ 0 ], |
|
94 | 94 | $row->toArray() |
95 | 95 | ); |
96 | 96 | |
97 | 97 | $this->assertTrue($iterator->hasNext()); |
98 | 98 | $row = $iterator->moveNext(); |
99 | 99 | $this->assertEquals( |
100 | - $this->getExpectedUsersVersion0()[1], |
|
100 | + $this->getExpectedUsersVersion0()[ 1 ], |
|
101 | 101 | $row->toArray() |
102 | 102 | ); |
103 | 103 | |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | $this->assertTrue($iterator->hasNext()); |
121 | 121 | $row = $iterator->moveNext(); |
122 | 122 | $this->assertEquals( |
123 | - $this->getExpectedUsersVersion1()[0], |
|
123 | + $this->getExpectedUsersVersion1()[ 0 ], |
|
124 | 124 | $row->toArray() |
125 | 125 | ); |
126 | 126 | |
127 | 127 | $this->assertTrue($iterator->hasNext()); |
128 | 128 | $row = $iterator->moveNext(); |
129 | 129 | $this->assertEquals( |
130 | - $this->getExpectedUsersVersion1()[1], |
|
130 | + $this->getExpectedUsersVersion1()[ 1 ], |
|
131 | 131 | $row->toArray() |
132 | 132 | ); |
133 | 133 | |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | $this->assertTrue($iterator->hasNext()); |
151 | 151 | $row = $iterator->moveNext(); |
152 | 152 | $this->assertEquals( |
153 | - $this->getExpectedUsersVersion1()[0], |
|
153 | + $this->getExpectedUsersVersion1()[ 0 ], |
|
154 | 154 | $row->toArray() |
155 | 155 | ); |
156 | 156 | |
157 | 157 | $this->assertTrue($iterator->hasNext()); |
158 | 158 | $row = $iterator->moveNext(); |
159 | 159 | $this->assertEquals( |
160 | - $this->getExpectedUsersVersion1()[1], |
|
160 | + $this->getExpectedUsersVersion1()[ 1 ], |
|
161 | 161 | $row->toArray() |
162 | 162 | ); |
163 | 163 |