Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

add foreign key column laravel 5.8

update your `integer('user_id')` to `bigInteger('user_id')`
public function up() { 
        Schema::create('evaluation', function (Blueprint $table) { 
            $table->increments('id'); 
            $table->bigInteger('user_id')->unsigned()->index(); 
            $table->timestamps();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
        });
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #foreign #key #column #laravel
ADD COMMENT
Topic
Name
5+3 =