Added support for db prefix in command line installer

This commit is contained in:
Shahal Tharique
2020-06-14 23:51:52 +05:30
parent 1934b93353
commit 3902bcd18d
2 changed files with 12 additions and 6 deletions

View File

@ -141,14 +141,14 @@ class Installer
]);
}
public static function createDbTables($host, $port, $database, $username, $password)
public static function createDbTables($host, $port, $database, $username, $password, $prefix = null)
{
if (!static::isDbValid($host, $port, $database, $username, $password)) {
return false;
}
// Set database details
static::saveDbVariables($host, $port, $database, $username, $password);
static::saveDbVariables($host, $port, $database, $username, $password, $prefix);
// Try to increase the maximum execution time
set_time_limit(300); // 5 minutes
@ -199,9 +199,11 @@ class Installer
return true;
}
public static function saveDbVariables($host, $port, $database, $username, $password)
public static function saveDbVariables($host, $port, $database, $username, $password, $prefix = null)
{
$prefix = strtolower(Str::random(3) . '_');
if (is_null($prefix)){
$prefix = strtolower(Str::random(3) . '_');
}
// Update .env file
static::updateEnv([