Commit 26927771 authored by Jens Segers's avatar Jens Segers

Adding nullable method to Blueprint, fixes #90

parent 26b19c63
......@@ -44,7 +44,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
*
* @param string|array $columns
* @param array $options
* @return bool
* @return Blueprint
*/
public function index($columns = null, $options = array())
{
......@@ -72,7 +72,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
* Indicate that the given index should be dropped.
*
* @param string|array $columns
* @return bool
* @return Blueprint
*/
public function dropIndex($columns = null)
{
......@@ -90,7 +90,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
* Specify a unique index for the collection.
*
* @param string|array $columns
* @return bool
* @return Blueprint
*/
public function unique($columns = null, $name = null)
{
......@@ -104,7 +104,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
* Specify a non blocking index for the collection.
*
* @param string|array $columns
* @return bool
* @return Blueprint
*/
public function background($columns = null)
{
......@@ -118,7 +118,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
* Specify a sparse index for the collection.
*
* @param string|array $columns
* @return bool
* @return Blueprint
*/
public function sparse($columns = null)
{
......@@ -134,7 +134,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
*
* @param string|array $columns
* @param int $seconds
* @return bool
* @return Blueprint
*/
public function expire($columns, $seconds)
{
......@@ -168,6 +168,16 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
$this->collection->drop();
}
/**
* Allow an attribute to be null, does not do anything.
*
* @return Blueprint
*/
public function nullable()
{
return $this;
}
/**
* Add a new column to the blueprint.
*
......
......@@ -92,6 +92,22 @@ class SchemaTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(60, $index['expireAfterSeconds']);
}
public function testSoftDeletes()
{
Schema::collection('newcollection', function($collection)
{
$collection->softDeletes();
});
Schema::collection('newcollection', function($collection)
{
$collection->string('email')->nullable()->index();
});
$index = $this->getIndex('newcollection', 'email');
$this->assertEquals(1, $index['key']['email']);
}
public function testFluent()
{
Schema::collection('newcollection', function($collection)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment