Laravel- Why "personal_access_tokens" table is created even after removing the migration file

196 Views Asked by At

I created a new project using Laravel version 10, generating several migration files. Subsequently, I removed certain pre-existing files that were present upon project creation from the migration directory, namely: users, password_reset_tokens, failed_jobs, and personal_access_tokens.

However, upon attempting to execute the migrate command to establish the schema within the database, I observed that personal_access_tokens was also being created.

Despite efforts to clear the cache, dump the database, and retry, the issue persisted.

I explored two potential solutions:

  1. Insert Sanctum::ignoreMigrations() within the register method of the AppServiceProvider.php class.
  2. Uninstall/Remove the Sanctum package, which was pre-installed upon creating the Laravel application, and remove the sanctum.php configuration file from the config folder.

My confusion lies in why the personal_access_tokens table is being generated despite deleting its corresponding migration file. How is it triggered to create a table, and how does it retrieve schema details even after the migration file is removed?

Furthermore, when attempting to remove the Sanctum dependency from the composer.json file, I also had to delete the sanctum.php file from the config folder. Shouldn't there be a mechanism that automatically removes all dependencies of a package when it is uninstalled?

0

There are 0 best solutions below