3

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

When I run that I get an error:

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

When I search the entire project for this class name all I find is it mentioned in the error logs. If I go in to 'autoload_classmap.php' the line with my class name and migration file name is correct (I have copied and pasted over them just to make sure).

While Googling it people suggested to run a few other commands which I already have:

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

How else should I troubleshoot this?

Logik22
  • 51
  • 1
  • 5

2 Answers2

1

Found the issue.

The problem was I ran the migrations so my old table is created using my old table name/class/etc. Then I changed the migration file name/class and tried to php artisan migrate:refresh. When you do a 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 changed the name already) and it freaked out. To fix this I had to rename it to the original name, run php artisan migrate:rollback (all tables removed) and then run php artisan migrate:refresh to reload all of the tables including my table with the new name.

Logik22
  • 51
  • 1
  • 5
0

I ran into this same problem and solved it by going into the database migrations table and removing the name of the old migration.

The problem with the answer above was that I had to keep the migration file around with the incorrect name.

coderp
  • 56
  • 1
  • 5