@@ -32,7 +32,7 @@ |
||
32 | 32 | * Filters the connections and only returns the ones that match the migration type |
33 | 33 | * |
34 | 34 | * @param array $connection The database connections |
35 | - * @return bool Returns TRUE on a match, else FALSE |
|
35 | + * @return boolean|null Returns TRUE on a match, else FALSE |
|
36 | 36 | */ |
37 | 37 | protected function filterConnections($connection) |
38 | 38 | { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected function filterConnections($connection) |
38 | 38 | { |
39 | - switch($this->migrationType) |
|
39 | + switch ($this->migrationType) |
|
40 | 40 | { |
41 | 41 | case 'default': |
42 | 42 | return (empty($connection['migration_type']) || $connection['migration_type'] == 'default'); break; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | protected function getDefaultConnection() |
54 | 54 | { |
55 | 55 | $defaultConnection = \DB::getDefaultConnection(); |
56 | - $connection = \Config::get('database.connections.' . $defaultConnection); |
|
56 | + $connection = \Config::get('database.connections.'.$defaultConnection); |
|
57 | 57 | return (empty($connection) ? array() : array($defaultConnection => $connection)); |
58 | 58 | } |
59 | 59 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | protected function getConnectionsByType($filter = null) |
67 | 67 | { |
68 | 68 | $connections = array(); |
69 | - if($this->migrationType == "default" && empty($filter)) { |
|
69 | + if ($this->migrationType == "default" && empty($filter)) { |
|
70 | 70 | return $this->getDefaultConnection(); |
71 | 71 | } elseif (!empty($filter)) { |
72 | - $connections = \Config::get('database.connections.' . $filter); |
|
73 | - if(!empty($connections)) |
|
72 | + $connections = \Config::get('database.connections.'.$filter); |
|
73 | + if (!empty($connections)) |
|
74 | 74 | { |
75 | 75 | $connections = array($filter => $connections); |
76 | 76 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $connections = \Config::get('database.connections'); |
79 | 79 | } |
80 | 80 | |
81 | - if(!empty($connections)) |
|
81 | + if (!empty($connections)) |
|
82 | 82 | { |
83 | 83 | $connections = array_filter($connections, array($this, 'filterConnections')); |
84 | 84 | } |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 101 | protected function runMigrationsOnConnections($connections) |
102 | 102 | { |
103 | - foreach($connections as $name => $connection) |
|
103 | + foreach ($connections as $name => $connection) |
|
104 | 104 | { |
105 | 105 | $this->input->setOption('database', $name); |
106 | - if(isset($this->migrator)) |
|
106 | + if (isset($this->migrator)) |
|
107 | 107 | { |
108 | 108 | $this->migrator->setMigrationType(array_get($connection, 'migration_type', 'default')); |
109 | 109 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | { |
119 | 119 | $this->setMigrationType(); |
120 | 120 | $connections = $this->getConnectionsByType($this->input->getOption('database')); |
121 | - if(empty($connections)) |
|
121 | + if (empty($connections)) |
|
122 | 122 | { |
123 | 123 | $this->info("No connections found for the specified migration type"); |
124 | 124 | } else { |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Codengine\CustomMigrations\Commands\ResetCommand; |
6 | 6 | use Codengine\CustomMigrations\Commands\RollbackCommand; |
7 | 7 | use Illuminate\Database\MigrationServiceProvider; |
8 | -use Illuminate\Support\ServiceProvider; |
|
9 | 8 | |
10 | 9 | class CustomMigrationsServiceProvider extends MigrationServiceProvider { |
11 | 10 | /** |
@@ -58,7 +58,6 @@ |
||
58 | 58 | * Gets a filtered list of migrations and runs them |
59 | 59 | * |
60 | 60 | * @param array $migrations |
61 | - * @param bool $pretend |
|
62 | 61 | */ |
63 | 62 | public function runMigrationList($migrations, array $options=[]) |
64 | 63 | { |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | protected function filterMigrations($migration) |
42 | 42 | { |
43 | 43 | $instance = $this->resolve($migration); |
44 | - if(empty($instance->type)) |
|
44 | + if (empty($instance->type)) |
|
45 | 45 | { |
46 | 46 | $instance->type = 'default'; |
47 | 47 | } |
48 | 48 | |
49 | - if($this->migrationType != $instance->type) |
|
49 | + if ($this->migrationType != $instance->type) |
|
50 | 50 | { |
51 | 51 | return false; |
52 | 52 | } else { |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @param array $migrations |
61 | 61 | * @param bool $pretend |
62 | 62 | */ |
63 | - public function runMigrationList($migrations, array $options=[]) |
|
63 | + public function runMigrationList($migrations, array $options = []) |
|
64 | 64 | { |
65 | - $this->note("Running " . ($this->migrationType == "default" ? "default" : "custom") . " migrations for DB " . $this->connection); |
|
65 | + $this->note("Running ".($this->migrationType == "default" ? "default" : "custom")." migrations for DB ".$this->connection); |
|
66 | 66 | $migrations = array_filter($migrations, array($this, "filterMigrations")); |
67 | 67 | parent::runMigrationList($migrations, $options); |
68 | 68 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | public function call($command, array $arguments = array()) |
9 | 9 | { |
10 | - if($command === 'migrate' || $command === 'migrate:reset') |
|
10 | + if ($command === 'migrate' || $command === 'migrate:reset') |
|
11 | 11 | { |
12 | 12 | $arguments['--type'] = $this->input->getOption('type'); |
13 | 13 |