minchevz
minchevz

Reputation: 215

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.

Upvotes: 10

Views: 8211

Answers (2)

Abhishek
Abhishek

Reputation: 3967

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

Upvotes: 26

Niraj Shah
Niraj Shah

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

Related Questions