Skip to content

Commit

Permalink
Add nullable morph columns
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev committed Dec 20, 2016
1 parent 5bafd85 commit 7790c83
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Illuminate/Database/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,22 @@ public function morphs($name, $indexName = null)
$this->index(["{$name}_id", "{$name}_type"], $indexName);
}

/**
* Add nullable proper columns for a polymorphic table.
*
* @param string $name
* @param string|null $indexName
* @return void
*/
public function nullableMorphs($name, $indexName = null)
{
$this->unsignedInteger("{$name}_id")->nullable();

$this->string("{$name}_type")->nullable();

$this->index(["{$name}_id", "{$name}_type"], $indexName);
}

/**
* Adds the `remember_token` column to the table.
*
Expand Down

0 comments on commit 7790c83

Please sign in to comment.