@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | public function run(): void |
44 | 44 | { |
45 | 45 | if ($this->migrate) { |
46 | - Artisan::call('migrate'.($this->truncate ? ':refresh' : ''), [ |
|
46 | + Artisan::call('migrate' . ($this->truncate ? ':refresh' : ''), [ |
|
47 | 47 | '--database' => $this->to, |
48 | 48 | ]); |
49 | 49 | } |
50 | 50 | |
51 | 51 | foreach ($this->getTables() as $table) { |
52 | - $this->feedback(PHP_EOL.PHP_EOL."Table: $table", 'line'); |
|
52 | + $this->feedback(PHP_EOL . PHP_EOL . "Table: $table", 'line'); |
|
53 | 53 | |
54 | - if (! Schema::connection($this->from)->hasTable($table)) { |
|
54 | + if (!Schema::connection($this->from)->hasTable($table)) { |
|
55 | 55 | $this->feedback("Table '$table' does not exist in $this->from", 'error'); |
56 | 56 | |
57 | 57 | continue; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | $this->feedback("Creating '$this->to.$table' table", 'warn'); |
68 | 68 | |
69 | - Schema::connection($this->to)->create($table, function (Blueprint $table_bp) use ($table, $columns) { |
|
69 | + Schema::connection($this->to)->create($table, function(Blueprint $table_bp) use ($table, $columns) { |
|
70 | 70 | foreach ($columns as $column) { |
71 | 71 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
72 | 72 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | private function updateTable(string $table, string $column): void |
81 | 81 | { |
82 | - Schema::connection($this->to)->table($table, function (Blueprint $table_bp) use ($table, $column) { |
|
82 | + Schema::connection($this->to)->table($table, function(Blueprint $table_bp) use ($table, $column) { |
|
83 | 83 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
84 | 84 | |
85 | 85 | $table_bp->{$type}($column)->nullable(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function setOptions(array $options) |
113 | 113 | { |
114 | 114 | foreach ($options as $option => $value) { |
115 | - if (! isset($this->{$option})) { |
|
115 | + if (!isset($this->{$option})) { |
|
116 | 116 | $this->{$option} = $value; |
117 | 117 | } |
118 | 118 | } |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $this->tables = $this->getFromDb()->getDoctrineSchemaManager()->listTableNames(); |
145 | 145 | } |
146 | 146 | |
147 | - return array_filter($this->tables, function ($table) { |
|
148 | - return ! in_array($table, $this->skipTables, true); |
|
147 | + return array_filter($this->tables, function($table) { |
|
148 | + return !in_array($table, $this->skipTables, true); |
|
149 | 149 | }); |
150 | 150 | } |
151 | 151 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | while ($row = $statement->fetch(\PDO::FETCH_OBJ)) { |
192 | 192 | $exists = $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->first(); |
193 | 193 | |
194 | - if (! $exists) { |
|
195 | - $this->getToDb()->table($table)->insert((array) $row); |
|
194 | + if (!$exists) { |
|
195 | + $this->getToDb()->table($table)->insert((array)$row); |
|
196 | 196 | } else { |
197 | - $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array) $row); |
|
197 | + $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array)$row); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | if ($this->cli) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $builder = $this->fromDB->table($table); |
218 | 218 | $statement = $pdo->prepare($builder->toSql()); |
219 | 219 | |
220 | - if (! $statement instanceof \PDOStatement) { |
|
220 | + if (!$statement instanceof \PDOStatement) { |
|
221 | 221 | throw new PDOException("Could not prepare PDOStatement for $table"); |
222 | 222 | } |
223 | 223 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | if ($this->cli) { |
246 | 246 | $this->cli->{$type}($msg); |
247 | 247 | } else { |
248 | - echo PHP_EOL.$msg.PHP_EOL; |
|
248 | + echo PHP_EOL . $msg . PHP_EOL; |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | } |