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

Armani's avatar
Level 17

Can't remove personal_access_tokens from migration

Today I created a new project and noticed that in migration folder there is a new file named: personal_access_tokens I know it belongs to Sanctum package, and because I don't use Sanctum I removed the migration, then run php artisan migrate but it migrated this table also.

I couldn't find out how to remove this migration entirely.

Any help?

0 likes
27 replies
SilenceBringer's avatar

@armani it migrated this table, or just didn't removed it? Did you see it in console output and migrations table?

any chance you use schema:dump for migrations?

Armani's avatar
Level 17

I removed it from migration folder, after running php artisan migrate it will output the table that migrated successfully. I didn't use schema:dump.

SilenceBringer's avatar

@armani if you do not have migration for this table and do not have /database/schema/mysql-schema.dump file - it should works.

Show the screen of your migrations folder and output of php artisan migrate:fresh

Armani's avatar
Level 17

I found another copy of migration file in this address:

\vendor\laravel\sanctum\database\migrations19_12_14_000001_create_personal_access_tokens_table.php

I think this file will migrate to database

2 likes
Armani's avatar
Level 17

I'm sure that I'm in the right project in console. I also used composer dump-autoload but nothing changed.

I created another fresh project but it was the same.

martinbean's avatar

@armani Well if you install Sanctum then yes, Sanctum is going to run its migrations.

Why have you installed Sanctum if you don’t actually want Sanctum’s database tables?

Armani's avatar
Level 17

I didn't install Sanctum, I think in the newest version it is already installed.

martinbean's avatar

@armani Sanctum is only installed if you install it. It doesn’t come pre-installed with Laravel.

martinbean's avatar
Level 80

Well knock me down. That’s gross. Not every project needs Sanctum so why Taylor’s decided it should come pre-installed in every Laravel application now, I have no idea.

Simple answer is to remove it if you don’t need it: composer remove laravel/sanctum

10 likes
mburgess's avatar

Not knowing why it was installed, I didn't know whether I could remove it. Thanks!

One thing to note when you do uninstall it though, the default User model is calling Laravel\Sanctum\HasApiTokens, but it's not doing anything with it. Hopefully there aren't any more little Sanctum tendrils I'm missing!

ancarofl5's avatar

@William77470 To add to that, make sure you import it in the provider as well:

use Laravel\Sanctum\Sanctum;

or

\Laravel\Sanctum\Sanctum::ignoreMigrations();
7 likes
eskiesirius's avatar

Thank you for this because i am wondering why there is a personal token even if i didn't install laravel sanctum

syarifhd_'s avatar

dont you delete migration file from file directory, you can delete migration file from terminal using this code:

rm database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php

htdung83's avatar

@syarifhd_ Please read whole the discussion before giving an solution next time. That file was deleted but the migration 2019_12_14_000001_create_personal_access_tokens_table still ran. The right solution so far for this case cames from @william77470

louan's avatar

Its very simple! Just create a new migration with:

php artisan make:migation drop_personal_access_tokens_table

and then:

public function up(): void {
      Schema::dropIfExists('personal_access_tokens');
}
2 likes

Please or to participate in this conversation.