0

I run the Artisan command in the code like

Artisan::call('migrate', ['--path' => 'database/migrations/core']);

I Need to know the columns added by that batch of migration which ran recently. I tried using Artisan::output(); command but it returns the migration name alone.

Is there any way to get the column names of the migration batch or to extract the column name from the migration name?

Rehan
  • 3,813
  • 7
  • 37
  • 58
  • This is not functionality provided out of the box. What you're looking for is probably something similar to [this question](https://stackoverflow.com/questions/650238/how-to-show-the-last-queries-executed-on-mysql) – Ohgodwhy Apr 03 '18 at 15:53
  • Alright. Thanks. – Rehan Apr 03 '18 at 16:55

1 Answers1

0

You can analyze the Laravel query log:

DB::enableQueryLog();
Artisan::call('migrate', ['--path' => 'database/migrations/core']);
$log = DB::getQueryLog();
dd($log);
Jonas Staudenmeir
  • 24,815
  • 6
  • 63
  • 109