Mysql可以将两个foregin键指向同一个主键

时间:2016-09-26 18:05:43

标签: php mysql sql laravel

我想知道一个mysql表是否可以有两个FK列,并且在另一个表中对同一个PK进行预测,如下所示:

对话

          $table->increments('con_id');
          $table->string('subject', 45);
          $table->integer('sender_id')->unsigned()->index();
          $table->integer('recipient_id')->unsigned()->index();
          $table->foreign('sender_id')->references('user_id')->on('users')->onDelete('cascade');
          $table->foreign('recipient_id')->references('user_id')->on('users')->onDelete('cascade');

0 个答案:

没有答案