Reputation: 496
I keep getting an error while migrating in Laravel.
What is this error?
public function up()
{
Schema::create('consultation_provider', function (Blueprint $table) {
$table->id();
$table->foreignId('userId')->nullable()->constrained('users')->cascadeOnDelete();
$table->foreignId('providerId')->nullable()->constrained('users')->cascadeOnDelete();
$table->foreignId('consultationId')->constrained('consultations')->cascadeOnDelete();
$table->integer('adequacy', 10)->nullable();
$table->integer('honesty', 10)->nullable();
$table->integer('good_behaviour', 10)->nullable();
$table->timestamps();
});
}
Upvotes: 0
Views: 256
Reputation: 12188
$table->integer()
method accept two parameters, fist one is column name, second is Boolean determine if your column is auto increment.
so , when you use:
$table->integer('adequacy', 10)->nullable();
since 10 > 0 ,it will be:
$table->integer('adequacy', true)->nullable();
and sql table can have only one auto increment column, witch is in our case 'id'
you should remove the second argument.
$table->integer('adequacy')->nullable();
note: if you want to change your integer column type, you will find a lot of available columns integer types in doc.
Upvotes: 1