-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Labels
Description
It appears when creating a table the first integer field is considered a primary key and created; The example below will generate a mysql error:
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key defined (SQL: ***)
Schema::create('table_data', function(Blueprint $table)
{
$table->engine = 'InnoDB';
$table->integer('record_id', 10)->unsigned();
$table->double('price', 8, 4);
$table->date('date');
$table->primary(['record_id', 'price', 'date']);
});Where as the following does not throw an exception.
Schema::create('table_data', function(Blueprint $table)
{
$table->engine = 'InnoDB';
$table->string('record_id', 10);
$table->double('price', 8, 4);
$table->date('date');
$table->primary(['record_id', 'price', 'date']);
});EDIT: Also, it appears to create product_id as an AUTO_INCREMENT which is not true either.