[英]Can't rollback laravel migrate
I've created a migration for CreateUserTable successfully. 我已经为CreateUserTable成功创建了迁移。
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user', function(Blueprint $table)
{
$table->increments('id');
$table->string('email')->unique;
$table->string('password', 60);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('user');
}
}
but I'm not able to rollback: 但我无法回滚:
$ php artisan migrate:rollback
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'CreateUserTable' not found","file":"C:\\xampp\\htdocs\\laravel\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php","line":301}}
Someone suggested to run below but it give me an other error: 有人建议在下面跑,但它给了我另一个错误:
$ composer dump-autoload
Composer could not find the config file: C:\ProgramData\ComposerSetup\bin
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
Any solution to rollback and avoid this second error related to composer.json? 回滚的任何解决方案,并避免与composer.json相关的第二个错误? I'[m using Laravel 4 with fresh installation. 我正在使用Laravel 4进行全新安装。
Rollback often requires you to run composer dumpautoload
first. 回滚通常要求您首先运行composer dumpautoload
。 I've had the same problems in Laravel 5.1. 我在Laravel 5.1中遇到了同样的问题。
In your case dumpautoload
should be in one word - this way it works for me. 在您的情况下, dumpautoload
应该是一个词-这样对我dumpautoload
。
And of course composer
should be run in a folder that contains the composer.json
file. 当然, composer
应该在包含composer.json
文件的文件夹中运行。 This would be your Laravel project folder. 这将是您的Laravel项目文件夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.