من دو تا جدول دارم یکی content ,دیگری image
رابطه یک به چند دارند اما ارور میدهد
```
Foreign key constraint is incorrectly formed
کد من اینه من اول content رو میسازم بعد imageچون کلید خارجی دارد اما باز این ارور رو میده
Schema::create('content', function (Blueprint $table) {
$table->id();
$table->string('name_mobile',50);
$table->string('image_asle_url')->nullable();
$table->integer('Score_site')->nullable();
$table->double('Score_banchmark')->nullable();//کلا ۱۵ رقم میگیرد و ۸ رقم هم بعد اعشار میگیرد
$table->bigInteger("view")->nullable();
$table->string('seo_title')->nullable();
$table->string('seo_decription')->nullable();
$table->string('decription')->nullable();
$table->timestamps();
});
Schema::create('image', function (Blueprint $table) {
$table->id();
$table->string('image_url')->nullable();
$table->Integer('content_id');
$table->foreign('content_id')->references('id')->on('content')->onDelete('cascade');
$table->timestamps();
});@mehdisut
مشکل اینه که تایپ کلید خارجی باید دقیقا با تایپ رفرنسش یکی باشه ، الان تایپ content_id رو integer گذاشتید در صورتی که تایپ رفرنس id هست و اعداد منفی رو شامل نمیشه ، بنابرین
$table->Integer('content_id')->unsigned();@forughi.vahid
ممنون
شاید پاسخ شما همینجا باشد