Answer the question
In order to leave comments, you need to log in
How do you deal with migrations in Laravel when passport oauth is already installed?
Good afternoon.
Actually, while I'm roughly planning (experimenting) with the database, I don't want to fix all the changes through separate small migrations.
I often recreate the database ($ php artisan migrate:fresh --seed), losing OAuth data. Then you have to re-install the passport and register the token in the .env file.
How to avoid it? Clean up migration table with *oauth* records in database?
Thank you.
Answer the question
In order to leave comments, you need to log in
Yes, as answered above, you need to use seeds
. For example, I made a seed that simply updated the secret for the application:
after running migrations, installing a passport (passposrt:install), seeds
And already, for example, in postman there is nothing to update for testing, tokens are always the same
There are seeds for filling the database with all sorts of template / test data, but you can also fill it in migration.
In seeds, generate everything you need, incl. and a passport. It is better not to do it in migrations, because they are also launched in production, where it is better to do everything manually.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question