mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-05-15 20:47:33 +08:00
update migrations to support pg
This commit is contained in:
@@ -461,6 +461,30 @@ class NexusDB
|
||||
return nexus_config('nexus.database.default');
|
||||
}
|
||||
|
||||
public static function isMysql(): bool
|
||||
{
|
||||
return self::getConnectionName() === 'mysql';
|
||||
}
|
||||
|
||||
public static function isPgsql(): bool
|
||||
{
|
||||
return self::getConnectionName() === 'pgsql';
|
||||
}
|
||||
|
||||
public static function listColumnIndexNames(string $table, array $columns): array
|
||||
{
|
||||
$indexes = Schema::getIndexes($table);
|
||||
$indexesNames = [];
|
||||
foreach ($indexes as $index) {
|
||||
foreach ($columns as $columnName) {
|
||||
if (in_array($columnName, $index['columns'])) {
|
||||
$indexesNames[] = $index['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $indexesNames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class Install
|
||||
|
||||
protected $envNames = [
|
||||
'TIMEZONE',
|
||||
'DB_HOST', 'DB_PORT', 'DB_USERNAME', 'DB_PASSWORD', 'DB_DATABASE',
|
||||
'DB_CONNECTION', 'DB_HOST', 'DB_PORT', 'DB_USERNAME', 'DB_PASSWORD', 'DB_DATABASE',
|
||||
'REDIS_HOST', 'REDIS_PORT', 'REDIS_DB', 'REDIS_PASSWORD',
|
||||
'UID_STARTS',
|
||||
];
|
||||
@@ -483,6 +483,10 @@ class Install
|
||||
$item['type'] = 'select';
|
||||
$item['options'] = $this->listTimeZone();
|
||||
}
|
||||
if ($name == 'DB_CONNECTION') {
|
||||
$item['type'] = 'select';
|
||||
$item['options'] = ['mysql', 'pgsql'];
|
||||
}
|
||||
$formControls[] = $item;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user