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:
- Insert
Sanctum::ignoreMigrations()within the register method of theAppServiceProvider.phpclass. - Uninstall/Remove the Sanctum package, which was pre-installed upon creating the Laravel application, and remove the
sanctum.phpconfiguration file from theconfigfolder.
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?