mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2026-03-21 21:12:43 +01:00
feat: implement boris
This commit is contained in:
@@ -7,11 +7,33 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
private function indexExists(string $table, string $indexName): bool
|
||||
{
|
||||
return match (DB::getDriverName()) {
|
||||
'sqlite' => $this->sqliteIndexExists($table, $indexName),
|
||||
default => $this->mysqlIndexExists($table, $indexName),
|
||||
};
|
||||
}
|
||||
|
||||
private function mysqlIndexExists(string $table, string $indexName): bool
|
||||
{
|
||||
$result = DB::select("SHOW INDEX FROM {$table} WHERE Key_name = ?", [$indexName]);
|
||||
|
||||
return count($result) > 0;
|
||||
}
|
||||
|
||||
private function sqliteIndexExists(string $table, string $indexName): bool
|
||||
{
|
||||
$indexes = DB::select("PRAGMA index_list('{$table}')");
|
||||
|
||||
foreach ($indexes as $index) {
|
||||
if (($index->name ?? null) === $indexName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('champion_skins', function (Blueprint $table) {
|
||||
|
||||
Reference in New Issue
Block a user