title: php artisan migrate. Multiple primary key defined
body: <p><strong>My Problem</strong></p>
  
  <p>I'm building my first api using laravel  and am getting a multiple primary key defined error while trying to run <code>php artisan migrate</code> I don't understand how I have defined multiple primary keys. Every time I run a migrate I get these errors <a href="https://i.stack.imgur.com/jiPxX.png" rel="nofollow noreferrer">php artisan migrate error</a>.</p>
  
  <p><strong>My Troubleshooting</strong></p>
  
  <p>I thought since autoIncrementing() can only be used for a primary key that maybe that defined it as a primary key, so I altered <code>$table-&gt;increments('bus_id')-&gt;autoIncrement()-&gt;primary();</code> to <code>$table-&gt;increments('bus_id')-&gt;autoIncrement();</code> and <code>$table-&gt;increments('bus_id')-&gt;autoIncrement();</code></p>
  
  <p>Every time I had tried to run my migrations I dropped my database and re-created it and tried to run my migrations again (so it was a new database every time with no corrupt data) but still didn't make a difference.</p>
  
  <p>I checked my Connection.php that was mentioned in the picture of my error code above but didn't see anything pertaining to any primary keys.</p>
  
  <p><strong>My Question</strong></p>
  
  <p>My code is below, can someone help me understand how I'm making double primary keys?</p>
  
  <pre><code>    &lt;?php
  
  use Illuminate\Support\Facades\Schema;
  use Illuminate\Database\Schema\Blueprint;
  use Illuminate\Database\Migrations\Migration;
  
  class CreatePurchaseHistoryTable extends Migration
  {
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::create('purchase_history', function (Blueprint $table) {
              $table-&gt;increments('pur_id', 11);
              $table-&gt;string('pur_item', 255);
              $table-&gt;dateTimeTz('pur_date');
              $table-&gt;string('bus_name', 50);
              $table-&gt;double('pur_amount', 10, 2);
              $table-&gt;double('cashback_amount', 10, 2);
              $table-&gt;integer('bus_id', 11);
              $table-&gt;foreign('bus_id')-&gt;references('bus_id')-&gt;on('business');   
              $table-&gt;timestamps();
              $table-&gt;rememberToken();  
              $table-&gt;engine = 'InnoDB';  
          });
      }
  
      /**
       * Reverse the migrations.
       *
       * @return void
       */
      public function down()
      {
          Schema::dropIfExists('purchase_history');
      }
  }
  </code></pre>
  
  <p>Please note there are similar questions here on Stack overflow which I have also tried their solutions without any success
  After edit I'm still getting this error:</p>
  
  <pre><code>In Connection.php line 664:
  
    SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto colu
    mn and it must be defined as a key (SQL: create table `purchase_history` (`pur_id` int unsigned not null auto_incre
    ment primary key, `pur_item` varchar(255) not null, `pur_date` datetime not null, `bus_name` varchar(50) not null,
    `pur_amount` double(10, 2) not null, `cashback_amount` double(10, 2) not null, `bus_id` int not null auto_increment
     primary key, `created_at` timestamp null, `updated_at` timestamp null, `remember_token` varchar(100) null) default
     character set utf8mb4 collate utf8mb4_unicode_ci engine = InnoDB)
  </code></pre>
  
  <p><strong>After running php artisan migrate:refresh</strong>
  <a href="https://i.stack.imgur.com/tq9cm.png" rel="nofollow noreferrer">migrate:refresh error</a></p>
  
  <p><a href="https://i.stack.imgur.com/Wnyx2.png" rel="nofollow noreferrer">business table</a></p>