summaryrefslogtreecommitdiff
path: root/src/Database/Migration
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-09-16 00:58:25 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-09-16 14:53:33 +0200
commitedeab5e75ffa02b075c151ca03ea1038f61e4396 (patch)
tree66dd92ed7bc0ac47683fc84769613fabfb0c0080 /src/Database/Migration
parentd36de2d26f5af76d5d4f34f8620694c6d0368983 (diff)
Added Database class as a replacement for Db, fixed naming
Diffstat (limited to 'src/Database/Migration')
-rw-r--r--src/Database/Migration/Migrate.php14
-rw-r--r--src/Database/Migration/MigrationServiceProvider.php11
2 files changed, 14 insertions, 11 deletions
diff --git a/src/Database/Migration/Migrate.php b/src/Database/Migration/Migrate.php
index 3a08bb6e..cec8bc4a 100644
--- a/src/Database/Migration/Migrate.php
+++ b/src/Database/Migration/Migrate.php
@@ -18,7 +18,7 @@ class Migrate
protected $app;
/** @var SchemaBuilder */
- protected $scheme;
+ protected $schema;
/** @var callable */
protected $output;
@@ -29,13 +29,13 @@ class Migrate
/**
* Migrate constructor
*
- * @param SchemaBuilder $scheme
+ * @param SchemaBuilder $schema
* @param Application $app
*/
- public function __construct(SchemaBuilder $scheme, Application $app)
+ public function __construct(SchemaBuilder $schema, Application $app)
{
$this->app = $app;
- $this->scheme = $scheme;
+ $this->schema = $schema;
$this->output = function () { };
}
@@ -160,11 +160,11 @@ class Migrate
*/
protected function initMigration()
{
- if ($this->scheme->hasTable($this->table)) {
+ if ($this->schema->hasTable($this->table)) {
return;
}
- $this->scheme->create($this->table, function (Blueprint $table) {
+ $this->schema->create($this->table, function (Blueprint $table) {
$table->increments('id');
$table->string('migration');
});
@@ -177,7 +177,7 @@ class Migrate
*/
protected function getTableQuery()
{
- return $this->scheme->getConnection()->table($this->table);
+ return $this->schema->getConnection()->table($this->table);
}
/**
diff --git a/src/Database/Migration/MigrationServiceProvider.php b/src/Database/Migration/MigrationServiceProvider.php
index 15d06eaf..310b2114 100644
--- a/src/Database/Migration/MigrationServiceProvider.php
+++ b/src/Database/Migration/MigrationServiceProvider.php
@@ -3,16 +3,19 @@
namespace Engelsystem\Database\Migration;
use Engelsystem\Container\ServiceProvider;
-use Engelsystem\Database\Db;
+use Engelsystem\Database\Database;
use Illuminate\Database\Schema\Builder as SchemaBuilder;
class MigrationServiceProvider extends ServiceProvider
{
public function register()
{
- $schema = Db::connection()->getSchemaBuilder();
- $this->app->instance('db.scheme', $schema);
- $this->app->bind(SchemaBuilder::class, 'db.scheme');
+ /** @var Database $database */
+ $database = $this->app->get(Database::class);
+ $schema = $database->getConnection()->getSchemaBuilder();
+
+ $this->app->instance('db.schema', $schema);
+ $this->app->bind(SchemaBuilder::class, 'db.schema');
$migration = $this->app->make(Migrate::class);
$this->app->instance('db.migration', $migration);