Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rmoiseev's avatar

Customize Passport migrations

I need to customize oauth_clients migration because I use UUID for user id

How can i do this?

0 likes
5 replies
rmoiseev's avatar

Problem is PassportServiceProvider does not publish migrations to database folder and running it form vendor dir instead.

davielee's avatar
davielee
Best Answer
Level 11

@rmoiseev You will have to make a new migration that will change the table instead. You can run the following command and then modify the up method like below.

php artisan make:migration --table=oauth_clients update_user_id_to_uuid_on_oauth_clients_table
public function up()
{
    Schema::table('oauth_clients', function (Blueprint $table) {
        $table->uuid('user_id')->index()->nullable()->change();
    });
}

In order to do this though, you will need to require dbal with composer.

composer require doctrine/dbal

4 likes
Oi_kholman's avatar

if you or someone else is still having this issue, run php artisan vendor:publish --tag=passport-migrations to have the migrations published into your migrations folder.

2 likes
rakeshpkumar's avatar

@Oi_kholman follwoing command won't publish the migration.

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

I tried but i get message publish complete but when i check my migration folder their was not any new migration. @rmoiseev for this to work just add this line in your appserviceprovider

Passport::ignoreMigrations();

and ofcourse the definition also

use Laravel\Passport\Passport;

1 like
Sergey_Dyachenko's avatar

If you wan customize passport migrations before running it. You should follow these steps after install passport

  1. run this command in terminal: php artisan vendor:publish --tag=passport-migrations - it's move migrations which you nedded to database/migrations folder

  2. After this, you can config then as you wish and then run php artisan migrate

Please or to participate in this conversation.