首页 文章

Laravel 5.2 php artisan migrate:回滚错误

提问于
浏览
3

我使用Laravel 5.2并通过运行创建了数据库表

php artisan make:migration create_categories_table --create=categories

php artisan make:migration create_posts_table --create=posts

然后我运行 php artisan migrate ,并在数据库中创建表 . 但是我在迁移文件"create_posts_table.php"中进行了一些更改并运行

php artisan migrate:rollback

我收到一个错误:

[Symfony \ Component \ Debug \ Exception \ FatalErrorException]未找到类'CreatePostsTable'PHP致命错误:在E:\ programfiles \ xampp \ htdocs \ deneme \ vendor \ laravel \ framework \ src \ Illuminate \中找不到类'CreatePostsTable'第336行的Database \ Migrations \ Migrator.php

我的create_posts_table.php是
enter image description here

我试过了 composer updatecomposer dump-autoload 但这还没有解决问题 .

2 回答

  • 4

    在运行迁移之前,应运行以下命令以确保已清除缓存:

    • php artisan clear-compiled

    • php artisan optimize

    这将确保您的新迁移类已正确注册 .

  • 8

    我遇到了同样的问题 . 这可以帮助某人:在运行 migrate:rollback 之前运行 composer dump-autoload .

相关问题