$table->primary(array('username', 'email'));
Because id is already defined as primary key via bigIncrements. I could be wrong though.
mgsmus said: Because id is already defined as primary key via bigIncrements. I could be wrong though.
just so!
fariss, for greater flexibility you could use 'bigInteger' instead of 'bigIncrements' as well
bigInteger($column, $autoIncrement = false, $unsigned = false)
like so
$table->bigInteger('id', true, true);
$table->primary(array('id', 'username', 'email'));
result should be the same
Though this is bug from Laravel, as we should drop all primary key(s) which is exists before add new one using alter method. Afaik autoincrement column must be set to be primary key and it done automatically in laravel (CMIW). For me, username and email better serve as unique_id rather than primary :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community