Reputation: 215
I use Laravel 5.2 and I created database tables by running
php artisan make:migration create_categories_table --create=categories
and
php artisan make:migration create_posts_table --create=posts
and then I run php artisan migrate
, and tables are created in database. But after I made some changes in migration file "create_posts_table.php" and run
php artisan migrate:rollback
I got an error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'CreatePostsTable' not found
PHP Fatal error: Class 'CreatePostsTable' not found in E:\programfiles\xampp\htdocs\deneme\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php on line 336
I tried composer update
, composer dump-autoload
but that hasn't fixed the problem.
Upvotes: 10
Views: 8211
Reputation: 3967
I was getting the same problem. May this helps somebody: run composer dump-autoload
before running migrate:rollback
.
Upvotes: 26
Reputation: 15457
Before you run a migration, you should run the following commands to make sure cache has been cleared:
php artisan clear-compiled
php artisan optimize
This will make sure your new migration class has been registered correctly.
Upvotes: 9