Run database create for sqlite
This commit is contained in:
@@ -117,7 +117,7 @@ class InstallerController extends AppBaseController
|
|||||||
);
|
);
|
||||||
|
|
||||||
$log[] = 'Creating database';
|
$log[] = 'Creating database';
|
||||||
$console_out = $this->dbService->setupDB();
|
$console_out = $this->dbService->setupDB($request->input('db_conn'));
|
||||||
|
|
||||||
return view('installer::steps/step2a-completed', [
|
return view('installer::steps/step2a-completed', [
|
||||||
'console_output' => $console_out
|
'console_output' => $console_out
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ class DatabaseService {
|
|||||||
* @throws \PDOException
|
* @throws \PDOException
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function checkDbConnection($type, $host, $port, $name, $user, $pass)
|
public function checkDbConnection($driver, $host, $port, $name, $user, $pass)
|
||||||
{
|
{
|
||||||
Log::info('Testing Connection: '.$type.'::'.$user.':'.$pass.'@'.$host.':'.$port.';'.$name);
|
Log::info('Testing Connection: '.$driver.'::'.$user.':'.$pass.'@'.$host.':'.$port.';'.$name);
|
||||||
|
|
||||||
if($type === 'mysql') {
|
if($driver === 'mysql') {
|
||||||
$dsn = "mysql:host=$host;port=$port;";
|
$dsn = "mysql:host=$host;port=$port;";
|
||||||
Log::info('Connection string: '. $dsn);
|
Log::info('Connection string: '. $dsn);
|
||||||
try {
|
try {
|
||||||
@@ -27,7 +27,7 @@ class DatabaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Needs testing
|
// Needs testing
|
||||||
elseif ($type === 'postgres') {
|
elseif ($driver === 'postgres') {
|
||||||
$dsn = "pgsql:host=$host;port=$port;dbname=$name";
|
$dsn = "pgsql:host=$host;port=$port;dbname=$name";
|
||||||
try {
|
try {
|
||||||
$conn = new PDO($dsn, $user, $pass);
|
$conn = new PDO($dsn, $user, $pass);
|
||||||
@@ -42,12 +42,14 @@ class DatabaseService {
|
|||||||
/**
|
/**
|
||||||
* Setup the database by running the migration commands
|
* Setup the database by running the migration commands
|
||||||
*/
|
*/
|
||||||
public function setupDB()
|
public function setupDB($db_driver='')
|
||||||
{
|
{
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
#\Artisan::call('database:create');
|
if($db_driver === 'sqlite') {
|
||||||
#$output .= \Artisan::output();
|
\Artisan::call('database:create');
|
||||||
|
$output .= \Artisan::output();
|
||||||
|
}
|
||||||
|
|
||||||
\Artisan::call('migrate');
|
\Artisan::call('migrate');
|
||||||
$output .= trim(\Artisan::output());
|
$output .= trim(\Artisan::output());
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ class EnvironmentService
|
|||||||
* Create the .env file
|
* Create the .env file
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function createEnvFile($type, $host, $port, $name, $user, $pass)
|
public function createEnvFile($driver, $host, $port, $name, $user, $pass)
|
||||||
{
|
{
|
||||||
$opts = [
|
$opts = [
|
||||||
'APP_ENV' => 'dev',
|
'APP_ENV' => 'dev',
|
||||||
'APP_KEY' => $this->createAppKey(),
|
'APP_KEY' => $this->createAppKey(),
|
||||||
'DB_CONN' => $type,
|
'DB_CONN' => $driver,
|
||||||
'DB_HOST' => $host,
|
'DB_HOST' => $host,
|
||||||
'DB_PORT' => $port,
|
'DB_PORT' => $port,
|
||||||
'DB_NAME' => $name,
|
'DB_NAME' => $name,
|
||||||
|
|||||||
Reference in New Issue
Block a user