Skip to content

A free open source IT asset/license management system

Add new indexes to locations and users for faster manager lookups

Brady Wetherington4fcf5ac7dae2
diff --git a/database/migrations/2024_11_06_211457_add_manager_indexes_to_location_and_user.php b/database/migrations/2024_11_06_211457_add_manager_indexes_to_location_and_user.php
new file mode 100644
index 0000000000..d1a151c126
--- /dev/null
+++ b/database/migrations/2024_11_06_211457_add_manager_indexes_to_location_and_user.php
@@ -0,0 +1,34 @@
+<?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('locations', function (Blueprint $table) {
+ $table->index('manager_id');
+ });
+ Schema::table('users', function (Blueprint $table) {
+ $table->index('manager_id');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('locations', function (Blueprint $table) {
+ $table->dropIndex(['manager_id']);
+ });
+ Schema::table('users', function (Blueprint $table) {
+ $table->dropIndex(['manager_id']);
+ });
+ }
+};