Add missing index for device_perf (#11974)

Makes the latency page load faster in case of a large device_perf table
This commit is contained in:
Jellyfrog
2020-07-31 16:07:00 +02:00
committed by GitHub
parent 973a39a0ac
commit cf13e92f05
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDevicePerfIndex extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('device_perf', function (Blueprint $table) {
$table->index(['device_id', 'timestamp']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('device_perf', function (Blueprint $table) {
$table->dropIndex(['device_id', 'timestamp']);
});
}
}