fixing database connections
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
namespace Lucent\Setup\Step;
|
||||
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Lucent\Database\Database;
|
||||
use Lucent\Setup\Data\SetupStep;
|
||||
|
||||
class DatabaseSetupStep implements IStep
|
||||
@@ -13,21 +13,18 @@ class DatabaseSetupStep implements IStep
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$name = "Database Connection";
|
||||
|
||||
$databaseConnectionName = config("lucent.database");
|
||||
|
||||
|
||||
$databaseConfig = config('database.connections.lucentdb');
|
||||
if(empty($databaseConfig)) {
|
||||
$databaseConfig = config('database.connections.'.$databaseConnectionName);
|
||||
if (empty($databaseConfig)) {
|
||||
$instructions = <<<EOD
|
||||
# You need to setup a database connection for lucentdb in database.php config. You can choose either sqlite or pgsql
|
||||
# You need to setup a database connection for $databaseConnectionName in database.php config. You can choose either sqlite or pgsql
|
||||
# example:
|
||||
|
||||
'connections' => [
|
||||
'lucentdb' => [
|
||||
'$databaseConnectionName' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('LUCENT_DATABASE_URL'),
|
||||
'database' => env('LUCENT_DB_DATABASE', database_path('database.sqlite')),
|
||||
@@ -39,8 +36,8 @@ EOD;
|
||||
}
|
||||
|
||||
try {
|
||||
DB::connection("lucentdb")->table("records")->get();
|
||||
}catch (QueryException $e) {
|
||||
Database::make()->table("records")->get();
|
||||
} catch (QueryException $e) {
|
||||
$instructions = <<<EOD
|
||||
# Make sure you run:
|
||||
php artisan lucent:setup-db
|
||||
|
||||
Reference in New Issue
Block a user