📜  添加外键列 laravel 5.8 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:00.375000             🧑  作者: Mango

代码示例4
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');
        });
    }