Search code examples
phplaravellaravel-5.3laravel-migrationsartisan-migrate

artisan migrate:rollback error in laravel 5.3


I'm trying to build a simple migration table and then trying to add a column in the table so following is my migration file:

class AddFlagToEmiTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('epins', function (Blueprint $table) {
            $table->boolean('flag');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */ 
    public function down()
    {
        Schema::table('epins', function (Blueprint $table) {
            //
        });
    }
}

In this I forgot to write the drop value which is:

$table->dropColumn('flag');

Now while adding this and trying to rollback and again the trying to do php artisan migrate it is showing error, and also it is showing output nothing to migrate respectively even I've added drop values in the migration.

I've already tried following:

php artisan optimize
php artisan clear-compiled
composer dump-autoload

It ain't helping me out please see the screenshot:

enter image description here

Help me out. Thanks!


Solution

  • its because artisan cannot find flag column in epins table

    There is workaround for this,

    add flagcolumn explicitly from phpmyadmin(if you are using mysql) and then try roll back

    Hope this method works, ask if any doubt