Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.2 php artisan migrate:rollback error

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

my create_posts_table.php is enter image description here

I tried composer update, composer dump-autoload but that hasn't fixed the problem.

like image 951
minchevz Avatar asked Mar 20 '16 15:03

minchevz


2 Answers

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.

like image 35
Niraj Shah Avatar answered Nov 14 '22 00:11

Niraj Shah


I was getting the same problem. May this helps somebody: run composer dump-autoload before running migrate:rollback.

like image 173
Abhishek Avatar answered Nov 14 '22 00:11

Abhishek