@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function register() |
27 | 27 | { |
28 | - $this->mergeConfigFrom(__DIR__.'/../config/database-synchronizer.php', 'database-synchronizer'); |
|
28 | + $this->mergeConfigFrom(__DIR__ . '/../config/database-synchronizer.php', 'database-synchronizer'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | public function run(): void |
59 | 59 | { |
60 | 60 | foreach ($this->getTables() as $table) { |
61 | - $this->feedback(PHP_EOL.PHP_EOL."Table: $table", 'line'); |
|
61 | + $this->feedback(PHP_EOL . PHP_EOL . "Table: $table", 'line'); |
|
62 | 62 | |
63 | - if (! Schema::connection($this->from)->hasTable($table)) { |
|
63 | + if (!Schema::connection($this->from)->hasTable($table)) { |
|
64 | 64 | $this->feedback("Table '$table' does not exist in $this->from", 'error'); |
65 | 65 | |
66 | 66 | continue; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $builder = $this->fromDB->table($table); |
114 | 114 | $statement = $pdo->prepare($builder->toSql()); |
115 | 115 | |
116 | - if (! $statement instanceof \PDOStatement) { |
|
116 | + if (!$statement instanceof \PDOStatement) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | while ($row = $statement->fetch(\PDO::FETCH_OBJ)) { |
137 | 137 | $exists = $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->first(); |
138 | 138 | |
139 | - if (! $exists) { |
|
140 | - $this->getToDb()->table($table)->insert((array) $row); |
|
139 | + if (!$exists) { |
|
140 | + $this->getToDb()->table($table)->insert((array)$row); |
|
141 | 141 | } else { |
142 | - $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array) $row); |
|
142 | + $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array)$row); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if (isset($bar)) { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | { |
162 | 162 | $this->feedback("Creating '$this->to.$table' table", 'warn'); |
163 | 163 | |
164 | - Schema::connection($this->to)->create($table, function (Blueprint $table_bp) use ($table, $columns) { |
|
164 | + Schema::connection($this->to)->create($table, function(Blueprint $table_bp) use ($table, $columns) { |
|
165 | 165 | foreach ($columns as $column) { |
166 | 166 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
167 | 167 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | private function updateTable(string $table, string $column): void |
176 | 176 | { |
177 | - Schema::connection($this->to)->table($table, function (Blueprint $table_bp) use ($table, $column) { |
|
177 | + Schema::connection($this->to)->table($table, function(Blueprint $table_bp) use ($table, $column) { |
|
178 | 178 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
179 | 179 | |
180 | 180 | $table_bp->{$type}($column)->nullable(); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | if ($this->cli) { |
189 | 189 | $this->cli->{$type}($msg); |
190 | 190 | } else { |
191 | - echo PHP_EOL.$msg.PHP_EOL; |
|
191 | + echo PHP_EOL . $msg . PHP_EOL; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | } |
@@ -54,14 +54,14 @@ |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($this->option('limit')) { |
57 | - $synchronizer->limit = (int) $this->option('limit'); |
|
57 | + $synchronizer->limit = (int)$this->option('limit'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $synchronizer->truncate = $this->option('truncate'); |
61 | 61 | |
62 | 62 | $synchronizer->run(); |
63 | 63 | |
64 | - $this->info(PHP_EOL.'Synchronization done!'); |
|
64 | + $this->info(PHP_EOL . 'Synchronization done!'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | private function getTables() |