samedi 27 février 2016

error with migrate refresh

I am getting this error when trying to run: php artisan migrate:refresh:

Rolled back: 2016_02_16_114444_create_posts_table
Rolled back: 2016_01_20_234538_expectations
Rolled back: 2016_01_20_200616_expectation_profile
Rolled back: 2015_12_22_111958_create_profiles_table
Rolled back: 2014_10_12_100000_create_password_resets_table
Rolled back: 2014_10_12_000000_create_users_table


  [Illuminate\Database\QueryException]                                          
  SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'follower  
  _id' (SQL: alter table `follower_followee` add `follower_id` int unsigned no  
  t null, add `followee_id` int unsigned not null)                              

  [PDOException]                                                                
  SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'follower  
  _id'

This is the migration the error refers to:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class FollowerFollowee extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('follower_followee', function (Blueprint $table) 
        {
            $table->integer('follower_id')->unsigned(); // follower id number,must be positive.
            $table->integer('followee_id')->unsigned(); // followee id number,must be positive.
            $table->foreign('follower_id')->references('id')->on('users')->onDelete('cascade');
            //The 'follower_id' column references to the 'id' column in a 'users' table.
            //When a user is deleted in the parent column ('follower_id'), then also the user in 'id' ('users') is deleted. 
            $table->foreign('followee_id')->references('id')->on('users')->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()

{
    Schema::dropIfExists('follower_followee');
    }
}

when trying to run : composer dump-autoload - it returns only this:

Generating autoload files

I honestly can't identify where's that duplication appears. Any help would be lovely.

Thank you.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1XRAEkp
via IFTTT

Aucun commentaire:

Enregistrer un commentaire