Skip to content

A free open source IT asset/license management system

Add new indexes to improve some Location queries

Brady Wetheringtonddaa75a6ddad
diff --git a/database/migrations/2026_04_07_141412_add_locations_parent_id_index.php b/database/migrations/2026_04_07_141412_add_locations_parent_id_index.php
new file mode 100644
index 0000000000..9c1a9ff830
--- /dev/null
+++ b/database/migrations/2026_04_07_141412_add_locations_parent_id_index.php
@@ -0,0 +1,28 @@
+<?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(['parent_id','deleted_at']);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('locations', function (Blueprint $table) {
+ $table->dropIndex(['parent_id','deleted_at']);
+ });
+ }
+};
diff --git a/database/migrations/2026_04_07_141930_accessories_checkout_assigned_to_index.php b/database/migrations/2026_04_07_141930_accessories_checkout_assigned_to_index.php
new file mode 100644
index 0000000000..4e723570ef
--- /dev/null
+++ b/database/migrations/2026_04_07_141930_accessories_checkout_assigned_to_index.php
@@ -0,0 +1,28 @@
+<?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('accessories_checkout', function (Blueprint $table) {
+ $table->index(['assigned_to','assigned_type']);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('accessories_checkout', function (Blueprint $table) {
+ $table->dropIndex(['assigned_to','assigned_type']);
+ });
+ }
+};