Skip to content

Commit

Permalink
fix: add foreign key on tagged.tag_id cartalyst#39
Browse files Browse the repository at this point in the history
  • Loading branch information
AidasK authored Oct 14, 2020
1 parent 0471c83 commit a0ac211
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public function up()
$table->engine = 'InnoDB';

$table->index(['taggable_type', 'taggable_id']);
$table->foreign('tag_id')->references('id')->on('tags')
->onDelete('cascade')
->onUpdate('cascade');
});

Schema::create('tags', function (Blueprint $table) {
Expand Down

0 comments on commit a0ac211

Please sign in to comment.