Laravel - Changed name / class of migration file, migrate: reset is still looking for old class

I changed the name of the migration file, updated the class name, ran 'composer dump-autoload' and then executed 'php artisan migrate: reset'.

On startup, I get the error:

[Symfony \ Component \ Debug \ Exception \ FatalErrorException] Class "OldClassName" not found

When I go through the whole project for this class name, everything I find is mentioned in the error logs. If I go to "autoload_classmap.php" the line with my class name and migration file name is correct (I copied and pasted over them to make sure).

While Google Googling suggested running a few other commands I already have:

php artisan clear-cache
Vagrant reload
composer self-update
composer update

      

How else can you fix this problem?

+3


source to share


2 answers


Problem detected.



The problem was that I did a migration, so my old table was created using my old table / class name / etc. Then I changed the name / class of the migration file and tried php artisan migrate:refresh

. When you do refresh

, it rolls back all your tables and then re-migrates them, so when it tried to rollback my old table it didn't find it (because I already changed the name) and it got scared. To fix this, I had to rename it to its original name, run php artisan migrate:rollback

(all tables are deleted) and then run php artisan migrate:refresh

to reload all tables, including my table, with a new name.

+1


source


I faced this same problem and solved it by going into the database migration table and deleting the old migration name.



The problem with the above answer was that I had to store the migration file with the wrong name.

0


source







All Articles