Ограничение внешнего ключа неправильно сформировано при создании миграции - PullRequest
0 голосов
/ 01 июля 2019

General error: 1005 Can't create table eapi . # sql-12e8_2 (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table products add constraint products_user_id_foreign foreign key ( user_id ) references user ( id`) при каскаде удаления)

Schema::create('products', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->string('name');
        $table->integer('price');
        $table->text('details');
        $table->unsignedBigInteger('user_id');
        $table->foreign('user_id')->references('id')->on('user')->onDelete('cascade');
        $table->timestamps();
    });
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...