]> _ Git - cubist_cms-back.git/commitdiff
#2783
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 24 May 2019 18:32:54 +0000 (20:32 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 24 May 2019 18:32:54 +0000 (20:32 +0200)
src/app/Console/Commands/MigrateCommand.php

index df5f35dde7aa58b1333108b8d5e34c2bd50cc331..721bed0653aac52f9d03e386d208992fe97aee3a 100644 (file)
@@ -38,20 +38,21 @@ class MigrateCommand extends CubistCommand
 
         $this->_handleMagicFolder([$this, '_migrate']);
 
-        $drivers = ['mysql' => 'pdo_mysql'];
+        $prefix = 'database.connections.' . config('database.default') . '.';
 
+        $drivers = ['mysql' => 'pdo_mysql'];
 
         $comparator = new Comparator();
-        $connection = DriverManager::getConnection([
-            'host' => env('DB_HOST'),
-            'port' => env('DB_PORT'),
-            'user' => env('DB_USERNAME'),
-            'password' => env('DB_PASSWORD'),
-            'driver' => $drivers[env('DB_CONNECTION')],
-            'dbname' => env('DB_DATABASE'),
-        ],
-            env('DB_CONNECTION')
-        );
+        $params=[
+            'host' => config($prefix . 'host'),
+            'port' => config($prefix . '.port'),
+            'user' => config($prefix . '.username'),
+            'password' => config($prefix . '.password'),
+            'driver' => $drivers[config($prefix . '.driver')],
+            'dbname' => config($prefix . '.database'),
+        ];
+        $this->line( print_r($params,true));
+        $connection = DriverManager::getConnection($params);
         $currentSchema = $connection->getSchemaManager()->createSchema();
         $diff = $comparator->compare($currentSchema, $this->_schema);