title: Laravel 4: How do I create a non-primary auto incrementing column with migrations?
body: <p>I'm currently working on a Laravel 4 project consisting of a master server and many clients. The clients create data and send this to the master server. To avoid conflicts I am using UUID v4 as the primary key.</p>
  
  <p>However, once the data is created on the server I want to assign a unique auto-incrementing integer so it is easier for users to identify the data. For example: Instead of speaking about <code>item 5a8e896d-3ab4-48d2-9d39-faeb5227f012</code> a user can speak about <code>item #24567</code></p>
  
  <p>To keep my app managable I am using migrations, my current migration for this table looks like this:</p>
  
  <pre><code>public function up()
  {
      Schema::table('items', function($table)
      {
          $table-&gt;create();
          $table-&gt;string('id')-&gt;primary(); //'id' For the purpose of keeping the ORM working, this field stores the UUID.
          $table-&gt;integer('number', true); //The human readable item number, the second parameter is true for auto-increment
          $table-&gt;text('otherdata');
          $table-&gt;timestamps();
      });
  }
  </code></pre>
  
  <p>The problem is that Laravel automagically creates a primary key when defining auto-increment and so the migration ends up failing because there are two primary keys.</p>
  
  <pre><code>[Exception] SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key defined
    (SQL: alter table `items` add primary key items_id_primary(`id`)) (Bindings: array ())
  </code></pre>
  
  <p>Is there any way to have a table with a primary key and a seperate auto-incrementing field using Laravel 4 migrations.</p>