Skip to content

A free open source IT asset/license management system

Fixed #8486: Add index for asset serial number

Travis Millerebe7c2da879d
diff --git a/database/migrations/2021_06_07_155421_add_serial_number_indexes.php b/database/migrations/2021_06_07_155421_add_serial_number_indexes.php
new file mode 100644
index 0000000000..3673489c7e
--- /dev/null
+++ b/database/migrations/2021_06_07_155421_add_serial_number_indexes.php
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddSerialNumberIndexes extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('assets', function (Blueprint $table) {
+ $table->index(['serial']);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('assets', function (Blueprint $table) {
+ $table->dropIndex(['serial']);
+ });
+ }
+}