Commit e998cd0a authored by Stas's avatar Stas Committed by Jens Segers

Add arg options for creating collections with options (#1734)

parent a612c5f0
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"illuminate/container": "^5.8", "illuminate/container": "^5.8",
"illuminate/database": "^5.8", "illuminate/database": "^5.8",
"illuminate/events": "^5.8", "illuminate/events": "^5.8",
"mongodb/mongodb": "^1.0" "mongodb/mongodb": "^1.4"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^6.0|^7.0", "phpunit/phpunit": "^6.0|^7.0",
......
...@@ -85,11 +85,11 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -85,11 +85,11 @@ class Builder extends \Illuminate\Database\Schema\Builder
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function create($collection, Closure $callback = null) public function create($collection, Closure $callback = null, array $options = [])
{ {
$blueprint = $this->createBlueprint($collection); $blueprint = $this->createBlueprint($collection);
$blueprint->create(); $blueprint->create($options);
if ($callback) { if ($callback) {
$callback($blueprint); $callback($blueprint);
......
...@@ -5,6 +5,7 @@ class SchemaTest extends TestCase ...@@ -5,6 +5,7 @@ class SchemaTest extends TestCase
public function tearDown(): void public function tearDown(): void
{ {
Schema::drop('newcollection'); Schema::drop('newcollection');
Schema::drop('newcollection_two');
} }
public function testCreate() public function testCreate()
...@@ -25,6 +26,13 @@ class SchemaTest extends TestCase ...@@ -25,6 +26,13 @@ class SchemaTest extends TestCase
$this->assertTrue(Schema::hasCollection('newcollection')); $this->assertTrue(Schema::hasCollection('newcollection'));
} }
public function testCreateWithOptions()
{
Schema::create('newcollection_two', null, ['capped' => true, 'size' => 1024]);
$this->assertTrue(Schema::hasCollection('newcollection_two'));
$this->assertTrue(Schema::hasTable('newcollection_two'));
}
public function testDrop() public function testDrop()
{ {
Schema::create('newcollection'); Schema::create('newcollection');
......
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