Support the ongoing development of Laravel.io →
posted 10 years ago
Database

I've created a migration for CreateUserTable successfully. <?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? I'[m using Laravel 4 with fresh installation.

Last updated 2 years ago.
0

I would have suggested that same command. In my experience, errors from migrations like come from the composer autoloader in your project. Usually dumping autoloader will rebuild with the new class names added. Also be sure you haven't renamed the file where it doesn't match the class name.

Last updated 2 years ago.
0

Run

php artisan optimize

and try again.

Last updated 2 years ago.
0

I've resolved the issues by running the below command:

COMPOSER=composer.json composer dump-autoload

What does COMPOSER=composer.json mean???

Last updated 2 years ago.
0

You need to first navigate to your project folder, THEN run composer dump-autoload.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

irfandayan irfandayan Joined 29 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.