The class did not detect an error after renaming the migration, despite the dumpautoload cache and cleaning

I have a simple laravel project with migrations that work fine. I want one of them to start first (so I can use this table to restrict the foreign key during subsequent migration), so I renamed this porting script by adding “1_” to be the first in the list.

But when I start migrations from the moment the file is renamed, I get a fatal "class not found" error for class 152152CreatePeopleTable, from Migrator.php on line 324 - see the full stack trace below. (And when I rename the migration file back, the class will be found again when the migration is performed).

I updated the name in vendor / composer / autoload_classmap.php to match the updated file name (1_2015_09_06_152152_create_people_table.php) and the search in phpstorm, '152152_create_people' was not found anywhere except laravel.log, so there could be no old name file, right?

So, I cleared the cache and tried other recommendations from similar problems (thanks google / stackoverflow):

  • php artisan cache: clear
  • composer clearcache
  • composer dumpautoload
  • composer update just in case
  • I made sure that I also had a table with new migrations; I deleted ALL from my database tables (including migrations), then executed "php artisan migrate: install" (to create a new migration table) and "php artisan migrate" to make sure everything is running completely fresh, still the same mistake
  • hail mary: , autoload classmap composer.json, ( , ): ", " -? Laravel 4
  • . sqlite , postgres. Juuust , , database.php, sqlite .

/?

[2015-09-12 22:42:19] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class '152152CreatePeopleTable' not found' in /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:324
Stack trace:
#0 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(133): Symfony\Component\Debug\Exception\FatalErrorException->__construct()
#1 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(118): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalExceptionFromError()
#2 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(0): Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#3 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(129): Illuminate\Database\Migrations\Migrator->resolve()
#4 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(112): Illuminate\Database\Migrations\Migrator->runUp()
#5 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(85): Illuminate\Database\Migrations\Migrator->runMigrationList()
#6 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(74): Illuminate\Database\Migrations\Migrator->run()
#7 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(502): Illuminate\Database\Console\Migrations\MigrateCommand->fire()
#8 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(502): call_user_func_array:{/home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:502}()
#9 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php(150): Illuminate\Container\Container->call()
#10 /home/vagrant/Code/Family-laravel/vendor/symfony/console/Command/Command.php(259): Illuminate\Console\Command->execute()
#11 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Symfony\Component\Console\Command\Command->run()
#12 /home/vagrant/Code/Family-laravel/vendor/symfony/console/Application.php(878): Illuminate\Console\Command->run()
#13 /home/vagrant/Code/Family-laravel/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRunCommand()
#14 /home/vagrant/Code/Family-laravel/vendor/symfony/console/Application.php(126): Symfony\Component\Console\Application->doRun()
#15 /home/vagrant/Code/Family-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(100): Symfony\Component\Console\Application->run()
#16 /home/vagrant/Code/Family-laravel/artisan(36): Illuminate\Foundation\Console\Kernel->handle()
#17 /home/vagrant/Code/Family-laravel/artisan(0): {main}()
#18 {main}  
+4
2

Laravel , , "1_", Laravel , , .

, , 2014_01_06_152152_create_people_table.php, php artisan dump-autoload (, ). , , , :

, .

, artisan make:migration add_person_forein_key_to_{your_table} (, , , ). , , , .

+4

php artisan dump-autoload Laravel 5, composer dump-autoload

+3

Source: https://habr.com/ru/post/1607119/


All Articles