mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-05-15 04:27:34 +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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user