samedi 30 décembre 2017

Foreign key constraint is incorrectly formed error Laravel 5.5

I am getting an error when running the migration command.

This is the admin table schema

Schema::create('admin', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('user_id')->unique();

                $table->timestamps();

                $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
            });

And the other is the user table that comes with laravel installation.

I want to create a foreign key for user_id but it gives error



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DyUuws
via IFTTT

Aucun commentaire:

Enregistrer un commentaire