From 2328c7a318c22396ea0b99df6c576f8eae7c90e6 Mon Sep 17 00:00:00 2001 From: Matt McCaffrey Date: Thu, 16 Mar 2017 11:55:00 -0400 Subject: [PATCH 1/2] [5.4] Show output with migration name before starting a migration or rollback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Laravel shows the migration name when an UP or DOWN has finished, but not before it starts. It would be useful to see the migration name before it starts, in the runUp and runDown methods. I spent some time today trying to figure out why my simple migration was just hanging -- rebooting my VM and such, when it was actually a 10+ minute long migration a teammate had slipped in that was running before mine. Since there is no output until finished, I thought something was hanging. It would have been useful to know that it was busy running THAT migration. For language, I’d propose this: ```$this->note("Rolling back: {$file}"); $this->note("Migrating: {$file}");``` (to matched the ‘Rolled Back: ‘ and ‘Migrated: ' messages on completion.) --- src/Illuminate/Database/Migrations/Migrator.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Database/Migrations/Migrator.php b/src/Illuminate/Database/Migrations/Migrator.php index ecefe863ee9c..e1f6167e4a0c 100755 --- a/src/Illuminate/Database/Migrations/Migrator.php +++ b/src/Illuminate/Database/Migrations/Migrator.php @@ -171,6 +171,8 @@ protected function runUp($file, $batch, $pretend) if ($pretend) { return $this->pretendToRun($migration, 'up'); } + + $this->note("Migrating: {$file}"); $this->runMigration($migration, 'up'); @@ -316,6 +318,8 @@ protected function runDown($file, $migration, $pretend) $instance = $this->resolve( $name = $this->getMigrationName($file) ); + + $this->note("Rolling back: {$file}"); if ($pretend) { return $this->pretendToRun($instance, 'down'); From 3b96c7a743f6f0a954e2b8df05a9d65f3b456566 Mon Sep 17 00:00:00 2001 From: Matt McCaffrey Date: Thu, 16 Mar 2017 12:39:37 -0400 Subject: [PATCH 2/2] Showing name instead of full path --- src/Illuminate/Database/Migrations/Migrator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Database/Migrations/Migrator.php b/src/Illuminate/Database/Migrations/Migrator.php index e1f6167e4a0c..f8c10537689e 100755 --- a/src/Illuminate/Database/Migrations/Migrator.php +++ b/src/Illuminate/Database/Migrations/Migrator.php @@ -172,7 +172,7 @@ protected function runUp($file, $batch, $pretend) return $this->pretendToRun($migration, 'up'); } - $this->note("Migrating: {$file}"); + $this->note("Migrating: {$name}"); $this->runMigration($migration, 'up'); @@ -319,7 +319,7 @@ protected function runDown($file, $migration, $pretend) $name = $this->getMigrationName($file) ); - $this->note("Rolling back: {$file}"); + $this->note("Rolling back: {$name}"); if ($pretend) { return $this->pretendToRun($instance, 'down');