Passport: Artisan::call( 'migrate' ) don't runs Passport table migration

Created on 21 Aug 2017  路  8Comments  路  Source: laravel/passport

I'm trying to create an installation wizard, that's why i'm using Artisan::call facade to run table migration, but, when i'm running "Artisan::call( 'migrate' )", the passport tables aren't migrated, but when i'm using the CLI, it's migrated. What can be the issue ?

https://github.com/Blair2004/tendoo-laravel/blob/master/app/Services/Setup.php#L47

Most helpful comment

Oh, I didn't mean that you should call vendor:publish in your php code, I meant from the console. Sorry if I was unclear.

The migrations for passport aren't really likely to change in my opinion so it should be safe to publish them as part of your app. If you don't want to move the files for passport you can specify the path of migrations for the artisan command like so
Artisan::call('migrate', ['--path' => 'vendor/laravel/passport/database/migrations']);

All 8 comments

Not sure about the state of the app when Setup->createTables() is called so the service provider for Passport might not be loaded.

Quick fix would probably be to publish the Passport migration files so they're just sitting in the migrations folder and artisan can find them like normal.

php artisan vendor:publish --tag=passport-migrations

from https://laravel.com/docs/master/passport#installation

After having tried that command, well the migrations files aren't added on "database/migrations".

Not sure why that would be, but you can always just copy the files manually from
https://github.com/laravel/passport/tree/master/database/migrations
or your local copy from
.\vendor\laravelpassportdatabase\migrations

it seems like it's only because migration and commands are only available for CLI
https://github.com/laravel/passport/blob/44209f4119fefa65bf17c885881918eb95fd1131/src/PassportServiceProvider.php#L38

I hate hardcoding, i would like the system to be issue free even when somebody is making a fresh laravel install, and compatible with Passport next updates.

Oh, I didn't mean that you should call vendor:publish in your php code, I meant from the console. Sorry if I was unclear.

The migrations for passport aren't really likely to change in my opinion so it should be safe to publish them as part of your app. If you don't want to move the files for passport you can specify the path of migrations for the artisan command like so
Artisan::call('migrate', ['--path' => 'vendor/laravel/passport/database/migrations']);

Oh just let me try this. Thank you.

Thank you it's working

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seriousjelly picture seriousjelly  路  3Comments

Adesubomi picture Adesubomi  路  4Comments

s4uron picture s4uron  路  3Comments

Patskimoto picture Patskimoto  路  3Comments

gbgelado picture gbgelado  路  3Comments