Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Illuminate/Database/DatabaseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ protected function registerConnectionServices()
$this->app->bind('db.connection', function ($app) {
return $app['db']->connection();
});

$this->app->bind('db.schema', function ($app) {
return $app['db']->connection()->getSchemaBuilder();
});
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Support/Facades/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public static function connection($name)
}

/**
* Get a schema builder instance for the default connection.
* Get the registered name of the component.
*
* @return \Illuminate\Database\Schema\Builder
* @return string
*/
protected static function getFacadeAccessor()
{
return static::$app['db']->connection()->getSchemaBuilder();
return 'db.schema';
}
}
3 changes: 3 additions & 0 deletions tests/Database/DatabaseMigratorIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function setUp()

$container = new \Illuminate\Container\Container;
$container->instance('db', $db->getDatabaseManager());
$container->bind('db.schema', function ($c) {
return $c['db']->connection()->getSchemaBuilder();
});
\Illuminate\Support\Facades\Facade::setFacadeApplication($container);

$this->migrator = new Migrator(
Expand Down