سلام مجدد.
من موقع اجرای مایگریت برای manyToMany، خطلای زیر رو در لاراول 5.8 دریافت میکنم:
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1005 Can't create table `laravelauth`.`#sql-3774_56b` (errno: 150 "Foreign key constraint is incorrectly formed")
(SQL: alter table `note_tag` add constraint `note_tag_note_id_foreign` foreign key (`note_id`) references `notes` (`id`) on delete cascade on update cascade)
البته جدول piviot ساخته شده ولی این خطا هم نمایش داده میشه
کدها:
public function up() { Schema::create('roles', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); $table->char('post',22); }); Schema::create('role_writer', function (Blueprint $table) { $table->integer('role_id')->unsigned()->index(); $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade')->onUpdate('cascade'); $table->integer('writer_id')->unsigned()->index(); $table->foreign('writer_id')->references('id')->on('writers')->onDelete('cascade')->onUpdate('cascade'); }); }
2024 © Copyright کليه حقوق مادی و معنوی براي چسبون محفوظ است و هرگونه کپی برداری پیگرد قانونی دارد.