Skip to content

A free open source IT asset/license management system

Add performance-improving indexes (#4278)

Brady Wetherington25d3d6688038
diff --git a/database/migrations/2017_10_20_234129_add_location_indices_to_assets.php b/database/migrations/2017_10_20_234129_add_location_indices_to_assets.php
new file mode 100644
index 0000000000..eb36933f6a
--- /dev/null
+++ b/database/migrations/2017_10_20_234129_add_location_indices_to_assets.php
@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddLocationIndicesToAssets extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('assets', function (Blueprint $table) {
+ $table->index('rtd_location_id');
+ $table->index(['assigned_type','assigned_to']);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('assets', function (Blueprint $table) {
+ //
+ $table->dropIndex(['rtd_location_id']);
+ $table->dropIndex(['assigned_type','assigned_to']);
+ });
+ }
+}