0
votes

I was wondering if there's a way to get the resultant mysql instructions from the command php artisan migrate.

This is needed because on my production server I can run mysql commands from PhpMyAdmin but I'm not allowed to run terminal scripts.

So my idea was to run php artisan migrate on my local environment and get the resultant mysql instructions to import "by hand" on production.

2

2 Answers

1
votes

You can call Artisan from code as @maximl337 mentioned but in case you want to look only show SQL that will be executed (without running it), you can use --pretend option this way:

php artisan migrate --pretend

and you will get this way the whole SQL that would be executed running migrations.

0
votes

Try calling Artisan command via code:

Route::get('/migrate', function () {
    Artisan::call('migrate', [
        '--force' => true,
    ]);
})->middleware(['admin']);

https://laravel.com/docs/5.1/artisan#calling-commands-via-code