Php – Laravel Migration: auto increment key when it is not primary

database-migrationlaravellaravel-4mysqlphp

I'm trying to create a table with Laravel migrations but I'm having some trouble.
I just need to create a table with a primary pair ('id' and 'revision'), being 'id' an auto increment.
I can do it in MySQL, but I can't manage to do it with Laravel Migrations since increments() also set the field as primary.
So far I have this:

Schema::create('bibliographies', function(Blueprint $table)
    {
        $table->increments('id');
        $table->integer('revision');
        ...
        $table->timestamps();
        $table->softDeletes();
        $table->primary(array('id', 'revision'));
    });

Note: changing increments() method is not an option since it is Laravel core.

Thank you for your help in advance.

Best Solution

Just drop the primary key before you re-add it:

$table->dropPrimary( 'id' );
$table->primary( array( 'id', 'revision' ) );
Related Question