Skip to content

A free open source IT asset/license management system

This adds some indexes for performance on license_seats

Brady Wetherington61813a6f2ca5
diff --git a/database/migrations/2022_07_07_010406_add_indexes_to_license_seats.php b/database/migrations/2022_07_07_010406_add_indexes_to_license_seats.php
new file mode 100644
index 0000000000..1a68a57fa6
--- /dev/null
+++ b/database/migrations/2022_07_07_010406_add_indexes_to_license_seats.php
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddIndexesToLicenseSeats extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('license_seats', function (Blueprint $table) {
+ $table->index(['assigned_to','license_id']);
+ $table->index(['asset_id','license_id']);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('license_seats', function (Blueprint $table) {
+ $table->dropIndex(['assigned_to','license_id']);
+ $table->dropIndex(['asset_id','license_id']);
+ });
+ }
+}