22-05-2026 Optimierung der User und Admin Panels
This commit is contained in:
parent
d2ba22c0cf
commit
e8c47b7553
73 changed files with 10282 additions and 1546 deletions
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table): void {
|
||||
if (! $this->hasIndex('companies', 'companies_owner_name_id_idx')) {
|
||||
$table->index(['owner_user_id', 'name', 'id'], 'companies_owner_name_id_idx');
|
||||
}
|
||||
|
||||
if (! $this->hasIndex('companies', 'companies_owner_active_name_id_idx')) {
|
||||
$table->index(['owner_user_id', 'is_active', 'name', 'id'], 'companies_owner_active_name_id_idx');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('press_releases', function (Blueprint $table): void {
|
||||
if (! $this->hasIndex('press_releases', 'press_releases_company_published_idx')) {
|
||||
$table->index(['company_id', 'published_at'], 'press_releases_company_published_idx');
|
||||
}
|
||||
|
||||
if (! $this->hasIndex('press_releases', 'press_releases_user_created_id_idx')) {
|
||||
$table->index(['user_id', 'created_at', 'id'], 'press_releases_user_created_id_idx');
|
||||
}
|
||||
|
||||
if (! $this->hasIndex('press_releases', 'press_releases_user_status_created_idx')) {
|
||||
$table->index(['user_id', 'status', 'created_at'], 'press_releases_user_status_created_idx');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('press_releases', function (Blueprint $table): void {
|
||||
if ($this->hasIndex('press_releases', 'press_releases_user_status_created_idx')) {
|
||||
$table->dropIndex('press_releases_user_status_created_idx');
|
||||
}
|
||||
|
||||
if ($this->hasIndex('press_releases', 'press_releases_user_created_id_idx')) {
|
||||
$table->dropIndex('press_releases_user_created_id_idx');
|
||||
}
|
||||
|
||||
if ($this->hasIndex('press_releases', 'press_releases_company_published_idx')) {
|
||||
$table->dropIndex('press_releases_company_published_idx');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table): void {
|
||||
if ($this->hasIndex('companies', 'companies_owner_active_name_id_idx')) {
|
||||
$table->dropIndex('companies_owner_active_name_id_idx');
|
||||
}
|
||||
|
||||
if ($this->hasIndex('companies', 'companies_owner_name_id_idx')) {
|
||||
$table->dropIndex('companies_owner_name_id_idx');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private function hasIndex(string $table, string $indexName): bool
|
||||
{
|
||||
return in_array($indexName, array_column(Schema::getIndexes($table), 'name'), true);
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue