lundi 18 mai 2020

SQLSTATE[HY000]: General error: 1005 Can't create table `laravel_work_faranesh`.`learnings`

hello i use this migrate and see this error

Schema::create('learnings', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('course_id')->unsigned();
            $table->foreign('course_id')->references('id')->on('courses')->onDelete('cascade');
            $table->bigInteger('user_id')->unsigned();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->timestamps();
        });

error:

 SQLSTATE[HY000]: General error: 1005 Can't create table `laravel_work_faranesh`.`learnings` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter tab
le `learnings` add constraint `learnings_course_id_foreign` foreign key (`course_id`) references `courses` (`id`) on delete cascade)


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire