started to add indexes and fixed N+1 issue

This commit is contained in:
Mark Gregory
2026-06-12 14:09:44 +01:00
parent 48371a281d
commit 05ff54ea76
8 changed files with 6 additions and 65 deletions
@@ -25,21 +25,4 @@ return new class extends Migration {
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::table('users', static function (Blueprint $table): void {
if (Schema::hasColumn('users', 'helpdesk_admin')) {
$table->dropColumn('helpdesk_admin');
}
if (Schema::hasColumn('users', 'helpdesk_agent')) {
$table->dropColumn('helpdesk_agent');
}
});
}
};
@@ -6,8 +6,8 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/** @return void */
return new class extends Migration
{
public function up(): void
{
Schema::create('helpdesk_statuses', static function (Blueprint $table): void {
@@ -70,14 +70,4 @@ return new class extends Migration {
$table->unique(['company_id', 'slug']);
});
}
/** @return void */
public function down(): void
{
Schema::dropIfExists('helpdesk_projects');
Schema::dropIfExists('helpdesk_teams');
Schema::dropIfExists('helpdesk_categories');
Schema::dropIfExists('helpdesk_priorities');
Schema::dropIfExists('helpdesk_statuses');
}
};
@@ -39,9 +39,4 @@ return new class extends Migration {
});
}
/** @return void */
public function down(): void
{
Schema::dropIfExists('helpdesk_tickets');
}
};
@@ -76,12 +76,4 @@ return new class extends Migration {
});
}
/** @return void */
public function down(): void
{
Schema::dropIfExists('helpdesk_workflow_logs');
Schema::dropIfExists('helpdesk_workflow_templates');
Schema::dropIfExists('helpdesk_git_commits');
Schema::dropIfExists('helpdesk_git_repositories');
}
};
@@ -38,10 +38,4 @@ return new class extends Migration {
});
}
/** @return void */
public function down(): void
{
Schema::dropIfExists('helpdesk_attachments');
Schema::dropIfExists('helpdesk_comments');
}
};
@@ -6,8 +6,8 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/** @return void */
return new class extends Migration
{
public function up(): void
{
Schema::create('helpdesk_category_user', static function (Blueprint $table): void {
@@ -18,10 +18,4 @@ return new class extends Migration {
$table->unique(['category_id', 'user_id']);
});
}
/** @return void */
public function down(): void
{
Schema::dropIfExists('helpdesk_category_user');
}
};
@@ -53,13 +53,4 @@ class HelpdeskPerformanceIndexes extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -43,6 +43,7 @@ final class HelpdeskDatabaseSeeder extends Seeder
['name' => 'Stalled', 'slug' => 'stalled', 'color' => 'rose', 'sort_order' => 30, 'is_closed' => false],
['name' => 'On-Hold', 'slug' => 'on-hold', 'color' => 'violet', 'sort_order' => 40, 'is_closed' => false],
['name' => 'Closed', 'slug' => 'closed', 'color' => 'emerald', 'sort_order' => 90, 'is_closed' => true],
['name' => 'Testing', 'slug' => 'testing', 'color' => 'green', 'sort_order' => 30, 'is_closed' => false],
] as $row) {
Status::query()->updateOrCreate(['slug' => $row['slug']], $row);
}
@@ -76,6 +77,7 @@ final class HelpdeskDatabaseSeeder extends Seeder
['name' => 'Systems Deployment', 'color' => 'cyan', 'description' => 'Deployment, release, infrastructure and environment requests.'],
['name' => 'Concepts', 'color' => 'purple', 'description' => 'Ideas, concepts, design discussion and future improvements.'],
['name' => 'Bug', 'color' => 'rose', 'description' => 'Defects, regressions and incorrect behaviour.'],
['name' => 'Documentation', 'color' => 'red', 'description' => 'System Documents creation or update.'],
] as $row) {
Category::query()->updateOrCreate(
['company_id' => null, 'slug' => Str::slug($row['name'])],