|
3 | 3 | namespace CrestApps\CodeGenerator\Commands\Migrations;
|
4 | 4 |
|
5 | 5 | use CrestApps\CodeGenerator\Commands\Bases\MigrationCommandBase;
|
| 6 | +use CrestApps\CodeGenerator\Support\Helpers; |
6 | 7 | use Illuminate\Console\ConfirmableTrait;
|
7 | 8 | use Illuminate\Database\Migrations\Migrator;
|
8 | 9 |
|
@@ -42,19 +43,31 @@ public function handle()
|
42 | 43 |
|
43 | 44 | $this->prepareDatabase();
|
44 | 45 |
|
45 |
| - // Next, we will check to see if a path option has been defined. If it has |
46 |
| - // we will use the path relative to the root of this installation folder |
47 |
| - // so that migrations may be run for any path within the applications. |
48 |
| - $this->migrator->run($this->getMigrationPaths(), [ |
49 |
| - 'pretend' => $this->option('pretend'), |
50 |
| - 'step' => $this->option('step'), |
51 |
| - ]); |
| 46 | + if (Helpers::isNewerThanOrEqualTo('5.7')) { |
| 47 | + // Next, we will check to see if a path option has been defined. If it has |
| 48 | + // we will use the path relative to the root of this installation folder |
| 49 | + // so that migrations may be run for any path within the applications. |
52 | 50 |
|
53 |
| - // Once the migrator has run we will grab the note output and send it out to |
54 |
| - // the console screen, since the migrator itself functions without having |
55 |
| - // any instances of the OutputInterface contract passed into the class. |
56 |
| - foreach ($this->migrator->getNotes() as $note) { |
57 |
| - $this->output->writeln($note); |
| 51 | + $this->migrator->setOutput($this->output) |
| 52 | + ->run($this->getMigrationPaths(), [ |
| 53 | + 'pretend' => $this->option('pretend'), |
| 54 | + 'step' => $this->option('step'), |
| 55 | + ]); |
| 56 | + } else { |
| 57 | + // Next, we will check to see if a path option has been defined. If it has |
| 58 | + // we will use the path relative to the root of this installation folder |
| 59 | + // so that migrations may be run for any path within the applications. |
| 60 | + $this->migrator->run($this->getMigrationPaths(), [ |
| 61 | + 'pretend' => $this->option('pretend'), |
| 62 | + 'step' => $this->option('step'), |
| 63 | + ]); |
| 64 | + |
| 65 | + // Once the migrator has run we will grab the note output and send it out to |
| 66 | + // the console screen, since the migrator itself functions without having |
| 67 | + // any instances of the OutputInterface contract passed into the class. |
| 68 | + foreach ($this->migrator->getNotes() as $note) { |
| 69 | + $this->output->writeln($note); |
| 70 | + } |
58 | 71 | }
|
59 | 72 |
|
60 | 73 | // Finally, if the "seed" option has been given, we will re-run the database
|
|
0 commit comments